Skip to content

Instantly share code, notes, and snippets.

@ivoo77
Created October 24, 2017 17:09
Show Gist options
  • Save ivoo77/e151dba30c853bdf914764c160f7883c to your computer and use it in GitHub Desktop.
Save ivoo77/e151dba30c853bdf914764c160f7883c to your computer and use it in GitHub Desktop.
PHP script for random 6 lottary numbers from 1 to 49
<?php
//script for random 6 lottary numbers from 1 to 49.
$lottoarray = array();
for($i=1;$i<=6;$i++){
do{
$random = random_int(1, 49);
}while (in_array($random, $lottoarray));
$lottoarray[] = $random;
}
for($j=0;$j<6;$j++){
$val=$lottoarray[$j];
echo '<h1>',$j+1,' Number - ',$val,'</h1>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment