Saturday, January 30, 2010

Generate Random Value

function random_code()
{
$string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz0123456789";
$randval = '' ;

for($i = 0;$i <= 10;$i++)
{
$num = rand() % 62;
$tmp = substr($string, $num, 1);
$randval = $randval.$tmp;
}
echo $randval.uniqid();
}
random_code();

No comments:

Post a Comment