note 6618 modified in function.each by felipe
| From: | felipe@php.net | Date: | Mon, 26 May 2008 19:49:41 +0000 |
| Subject: | note 6618 modified in function.each by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-139815@lists.php.net to get a copy of this message | ||
Note further that each() performs a shallow copy
of the value side of an (assoc) array; if you need to iterate on deep structures, something like:
<?php
reset($A); while (list($k,) = each($A)) {
$elem = &$A[$k];
/* ... */
}
?>
Is needed. Copy construction would be handy to have here.
--was--
Note further that each() performs a shallow copy
of the value side of an (assoc) array; if you need to iterate on deep structures, something
like:<br>
reset($A); while (list($k,) = each($A)) {<br>
$elem = &$A[$k];<br>
/* ... */<br>
}<br>
Is needed. Copy construction would be handy to have here.
http://php.net/manual/en/function.each.php