Home > Backend Development > PHP Tutorial > PHP Design Welfare Lottery Lucky Number Automatic Generator_PHP Tutorial

PHP Design Welfare Lottery Lucky Number Automatic Generator_PHP Tutorial

WBOY
Release: 2016-07-13 10:58:40
Original
1205 people have browsed it

Using PHP completely random design, each refresh will have different lucky numbers, give it a try, don’t forget neo when you get rich~~~
for ($n=1;$n<=5;$n ) {
echo "No.".$n."Note ";
$string="";//Initialization string
for ($i=1;$i<=7;$i ) {
mt_srand((double)microtime()*1000000);//Add the time factor to the millionth of a second during execution when the random number seed
$random=mt_rand(1,30);//Generate random numbers between 1-30
if (eregi($random,$string)){//Check whether this number already exists
$i--;
continue;//Jump out of the loop and return to the starting point of the judgment.
}
else{
$string=$string.",".$random;
echo $random," ";}
}
echo "
";
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631984.htmlTechArticleUsing PHP completely random design, each refresh will have different lucky numbers, give it a try, don’t forget it if you get rich neo~~~?php for ($n=1;$n=5;$n) { echo No.$n.Note; $string=;//Initialization string...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template