Re: Looping through arrays with foreach
- From: "Chung Leong" <chernyshevsky@xxxxxxxxxxx>
- Date: 31 Mar 2006 05:44:45 -0800
Sjoerd wrote:
Another method to loop through an array is the following:
<?php
while (list(, $value) = each($arr)) {
echo "Value: $value<br />\n";
}
?>
The main problem with the list() = each() construct is that it has a
side-effect--namely that of advancing the array's internal pointer.
Forgetting to call reset() on an array was a common mistake in PHP 3.
.
- References:
- Looping through arrays with foreach
- From: Sjoerd
- Looping through arrays with foreach
- Prev by Date: Re: updating form values without submit
- Next by Date: idea needed: Longrunning PHP-script/continious stream/browser 'pagerenew'
- Previous by thread: Re: Looping through arrays with foreach
- Next by thread: Re: Looping through arrays with foreach
- Index(es):
Relevant Pages
|