Re: Nested loopa

From: Date: Wed, 26 Dec 2012 00:49:55 +0000
Subject: Re: Nested loopa
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-319950@lists.php.net to get a copy of this message
On 26/12/2012, at 1:21 PM, Ken Arck <ah6le@ah6le.net> wrote: > So I cannot do nested do loops in php? > > <?php > $a = 0 ; > $b = 0 ; > do { > echo "$a\n" ; > do { > echo "$b\n" ; > $b++ > }while($b <=10) ; > $a++; > }while($a <= 20) ; > ?> You can, though you're never resetting the value of $b in the outer loop, so the inner loop will only run once each time after the first run of the outer. --- Simon Welsh Admin of http://simon.geek.nz/

« previous php.general (#319950) next »