note 51558 deleted from control-structures.for by nlopess

From: Date: Wed, 27 Apr 2005 17:25:19 +0000
Subject: note 51558 deleted from control-structures.for by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-88647@lists.php.net to get a copy of this message
Note Submitter: dumdumdaniel at hotmail dot com ---- spent some time trying to work this out, and still couldnt resolve it. $s is a multidimensional array, where the second level is associative and numeric array from mysql... i dont have a choice in the second level array type... the following code crashed the sever process <? for ( $x=0; $x<count($s); $x++ ) { foreach ($s[$x] as $key => $val) { echo '<br />'.$key.' - '.$val; } }?> instead i had to do: <? for ( $x=0; $x<count($s)-1; $x++ ) { for ( $y=0; $y<(count($s[$x])/2); $y++ ) { echo '<br />'.$y.' - '.$s[$x][$y]; } }?> i can only assume that the pointers are bugging up somewhere in the first example. hope this saves someone some time trying to figure out what may be wrong with their syntax

« previous php.notes (#88647) next »