Re: Split()
| From: | Jochem Maas | Date: | Tue, 17 Feb 2004 20:22:00 +0000 |
| Subject: | Re: Split() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178018@lists.php.net to get a copy of this message | ||
save a function call:
$applePie = array(1,2,3,4,5,6,7,8);
while ($pieceOfPie = array_shift($applePie)) {
echo $pieceOfPie; // want some pie?
}
Stuart wrote:
John Taylor-Johnston wrote:Can I while this? Not sure how to go about it? while ($pieces exist) { echo $pieces[i]; }This will empty the array so you might want to do this on a copy of it depending on whether it will be needed later in the script... while (count($pieces) > 0) {echo array_shift($pieces);} http://php.net/array_shift