I've created this code to output 20 random numbers from 5 to 100 in PHP. All the numbers must be different from each other. While executing I'm taking this error
This is my code:
<?php
$a=array();
while(count($a)<20){
$found=false;
$random=rand(6,100);
for($i=0;$i<=count($a);$i++){
if($a[$i]==$random){
$found==true;
break;
}
}
if(!$found)
$a[count($a)]=$random;
}
echo $a;
?>
Can someone help me to deal with this error? Thanks!
echo $a
. – isnisn Feb 16 '16 at 9:57