note 25263 added to control-structures.foreach

From: Date: Tue, 17 Sep 2002 14:06:12 +0000
Subject: note 25263 added to control-structures.foreach
Groups: php.notes 
Request: Send a blank email to php-notes+get-36837@lists.php.net to get a copy of this message
"Also note that foreach operates on a copy of the specified array, not the array itself, therefore the array pointer is not modified as with the each() construct and changes to the array element returned are not reflected in the original array." In other words, this will work (not too expected): foreach ($array as $array) { // ... } While this won't: while (list(, $array) = each($array)) { // ... } -- http://www.php.net/manual/en/control-structures.foreach.php http://master.php.net/manage/user-notes.php?action=edit+25263 http://master.php.net/manage/user-notes.php?action=delete+25263 http://master.php.net/manage/user-notes.php?action=reject+25263

« previous php.notes (#36837) next »