**PHP Lottery Number Generator**. The script will generate 6 unique numbers from 1 to 49. This was designed for the UK National Lottery but only takes a few seconds to edit for other lotteries.

To change the quantity of numbers you would like to generate, change the 6 on this line to however many numbers you need:

*while (count($numbers) < 6) {*

To increase the maximum number, change the 49 on both of these lines:

*$randomn = rand(1, 49);*

<?php

$x = 0;

$numbers[0] = 0;

while (count($numbers) < 6) {

$randomn = rand(1, 49);

while(in_array($randomn, $numbers)) {

$randomn = rand(1, 49);

}

$numbers[$x] = $randomn;

$x++;

echo "Number $x is: $randomn.<br />";

}

?>

Tip: To edit this script for the EuroMillions, simply copy and paste the whole script twice. On the second paste just edit the while loop from 6 to 2, and the rand from 49 to 9.

## 0 comments:

## Post a Comment