$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
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php