Re: Split()

From: Date: Wed, 18 Feb 2004 00:02:44 +0000
Subject: Re: Split()
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-178041@lists.php.net to get a copy of this message
On Tue, 2004-02-17 at 15:22, Jochem Maas wrote: > $applePie = array(1,2,3,4,5,6,7,8); > > while ($pieceOfPie = array_shift($applePie)) { > echo $pieceOfPie; // want some pie? > } Careful, that will eat your array as well. When the while loop finishes you won't have any pieces of pie left! IE: $applePie = array(1,2,3,4,5,6,7,8); while ($pieceOfPie = array_shift($applePie)) { echo $pieceOfPie; // want some pie? } // Both of these are now true: $applePie == array(); $applePie != array(1,2,3,4,5,6,7,8); -Adam -- Adam Bregenzer adam@bregenzer.net http://adam.bregenzer.net/

« previous php.general (#178041) next »