Re: generat unique id in php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello user this function
<?
echo random_string(6)
?>
function random_string($length) {
 // if you want extended ascii, then add the characters to the array
 $characters = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
 $random_str = "";
 for ($i = 0; $i < $length; $i++) {
  srand((double)microtime()*1000000);
  $random_chr = round(rand(0, count($characters)-1));
  $random_str .= $characters[$random_chr];
 }
 return ($random_str);
}
 


--- On Fri, 25/12/09, rahul dongre <mady_dongre@xxxxxxxxxxx> wrote:


From: rahul dongre <mady_dongre@xxxxxxxxxxx>
Subject:  generat unique id in php
To: "php" <php-objects@xxxxxxxxxxxxxxx>
Date: Friday, 25 December, 2009, 8:42 AM


  



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/

[Non-text portions of this message have been removed]









      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux