Hi Yasuo,

> Subject: Re: [PHP] Nested for() loops? -> Now Multi Dimension Arrays
> Date: Sat, 7 Apr 2001 12:57:02 +0900
> From: "Yasuo Ohgaki" <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> 
> Simple to fix it. You just need to resolve ambiguity with {}.
> 
> >      $res = $i * $j;
> >      $target_array[$i][$j] = $res;
> >      print("result = $target_array[$i][$j] <br>");
> 
> print("result = {$target_array[$i][$j]} <br>");
> 
> Regards,
> --
> Yasuo Ohgaki

Nope. Those curly brackets broke the code.

<?
 error_reporting(E_ALL);

 $target_array = array();

 echo "starting <br>";

  for( $i=0; $i<5; $i++ )
   for( $j=0; $j<5; $j++ )
   {
     $res = $i * $j;
     $target_array[] = $res;
     print("result = {$target_array[$i][$j]} <br>");
   }

  echo "done<br>";
?>

This is the output without the curly brackets:
starting 
result = 0[0] 
result = 0[1] 
result = 0[2] 
result = 0[0] 
result = 0[1] 
result = 0[2] 
done

This is the output with the curly brackets:

starting 
result = 
result = 
result = 
result = 
result = 
result = 
done

Anyone have any ideas on how to make this work?

Thanks in advance!!

John

-- 
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