Revision: 18198
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 23, 2009 15:53 by paulgrenwood
Initial Code
/************* *@l - length of random string */ function generate_rand($l){ $c= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; srand((double)microtime()*1000000); for($i=0; $i<$l; $i++) { $rand.= $c[rand()%strlen($c)]; } return $rand; }
Initial URL
Initial Description
If you don’t need human readable string, then use this function instead, which will create a random string you can use for user id’s etc.
Initial Title
Generate Random String
Initial Tags
php
Initial Language
PHP