Winning lottery numbers generator

I won £10 on the lottery last Saturday, so as a light hearted second post I am sharing with you the code that generated the winning numbers (also to test code highlighting in Wordpress).

$lottery = array();
while (count($lottery) < 6)
{
$number = rand(1,49);
if (!in_array($number, $lottery))
{
$lottery[] = $number;
}
}
echo implode(', ', $lottery);

Have your say

(Never published)
(Optional)

About the author

Tom Graham is a web developer living in Leicester, UK. This blog is his vent for all things web design and development. Read more about Tom.

Categories

Pages