Re: nested for loops

From: Date: Wed, 09 Jul 2003 18:10:09 +0000
Subject: Re: nested for loops
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-154603@lists.php.net to get a copy of this message
Also u can do nested foreach loops too... Example: while( $row = mysql_fetch_array( $result ) ) { $rows[] = $row; } foreach( $rows as $row ) { foreach( $row as $i => $value ) { // do stuff here echo "$i = $value\n"; } } I do this tons... -- bigdog On Wed, 2003-07-09 at 11:56, Micah Montoy wrote: > Anyone ever do a nested for loop? > > $i =0; > $j =0; > for ($x=0; $x < 50; $x++){ > echo ("1 to 50"); > > for ($j=0: $j < 5; $j++) { > echo ("less than 5"); > } > } > > I haven't seen a nested loop in PHP, so I'm not sure of the exact syntax. > > thanks > >

« previous php.general (#154603) next »