PHP彩票随机生成程序

喜欢买彩票的研究一下喽
<table width="400" border="1" cellspacing="0" cellpadding="0" >
<?php
for ($n=1;$n<=20;$n++) {
echo "<tr><td bgcolor=#cccccc width=80>第".$n."注 </td>";
$string="";//初始化字符串

for ($i=1;$i<=7;$i++) {
mt_srand((double)microtime()*1000000);//加入时间的因素,以执行时的百万分之一秒当乱数种子
$random=mt_rand(1,30);//产生1-30间的随机数


if (eregi($random,$string)){//检查此数是否已经存在

$i--;
continue;//跳出循环,回到判断起始处。
}

else{
$string=$string.",".$random;
   echo "<td bgcolor=#efefef>";
echo $random," ";}
}
echo "</td></tr>";
}
?>
</table>


文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: PHP 随即程序
相关日志:
评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.