note 76107 deleted from function.microtime by tularis

From: Date: Sun, 22 Jun 2008 12:05:25 +0000
Subject: note 76107 deleted from function.microtime by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140666@lists.php.net to get a copy of this message
Note Submitter: kayode muyibi ---- I use this for unique transactional ids. function randomString($randStringLength) { $timestring = microtime(); $secondsSinceEpoch=(integer) substr($timestring, strrpos($timestring, " "), 100); $microseconds=(double) $timestring; $seed = mt_rand(0,1000000000) + 10000000 * $microseconds + $secondsSinceEpoch; mt_srand($seed); $randstring = ""; for($i=0; $i < $randStringLength; $i++) { $randstring .= mt_rand(0, 9); $randstring .= chr(ord('A') + mt_rand(0, 5)); } return($randstring); }

« previous php.notes (#140666) next »