<?php
header('Content-type:text/html; charset=gb2312');
//隨機數
$rand = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%&*!";
$num = 1;
function rand_value($num, $rand)
{
$len = strlen($rand)-1;
$result = '';
while($num-->0)
{
$result.= $rand{ mt_rand(0,$len) };
}
return $result;
}
echo '測試的隨機數為:<font color=red>'.$rand_name = rand_value($num,$rand).'</font>';
?>