Hello Rahul, here is function that might help: function generateRandomCode() { $first_code = strtoupper(base_convert(rand(13330, 46655), 10, 36)); $second_code = rand(100, 999); return $first_code . "-" . $second_code; } Regards Adam rahul dongre wrote: > > hello all > > i want to generate a unique code for each customer that are going to > register on my site. > and each customer is identify by this unique code. > plz suggest me how i generate unique code like this "CUS-123" > > > > The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. > http://in.yahoo.com/ <http://in.yahoo.com/> > > [Non-text portions of this message have been removed] > > ------------------------------------ Are you looking for a PHP job? Join the PHP Professionals directory Now! http://www.phpclasses.org/jobs/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/php-objects/join (Yahoo! ID required) <*> To change settings via email: php-objects-digest@xxxxxxxxxxxxxxx php-objects-fullfeatured@xxxxxxxxxxxxxxx <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/