In the following code, I'm reading a variable set of random numbers into a
multi-dimensional array.

The first iteration runs properly, but when I get to my 2nd+ iteration, I
get the following errors;
Warning: Wrong datatype in sort() call in /home/usrlinux/WWW/pballs.php on
line 18
Warning: Invalid argument supplied for foreach() in
/home/usrlinux/WWW/pballs.php on line 19

Is there a specific function for sorting and foreach statements of
multidimensional arrays?  If so, why does it work properly for the first
interation,i.e. sort($num_array[1]) then subsequently fail on
sort($num_array[2])

Thank you in advance!


<?
srand ((double) microtime() * 1000000);
$totnum = 5;
$min = 1;   
$max = 49;
$tickcount=1;
$num_array = array();
array_push($num_array, array());
echo "Now Generating $tickets Tickets!<br>\n";
while ($tickcount <= $tickets)
{
 while ( $numbercount < $totnum)
  {
   $num_array[$tickcount][] = rand($min,$max);
   $numbers = array_unique($num_array[$tickcount]);
   $numbercount = count($num_array[$tickcount]);   
  }
 sort($num_array[$tickcount]);
 foreach($num_array[$tickcount] as $val)   
  {
   echo "<img src=ball.php?text=$val&color=grey>&nbsp;&nbsp";
  }
 $pb[$tickcount] = rand(1,42);
 print "<img src=ball.php?text=$pb[$tickcount]&color=red>";
 $tickcount++;
}
?>

___________________________
James C. Montz
James Tower
http://www.jamestower.com 
[EMAIL PROTECTED] 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to