note 68605 added to function.reset
| From: | m dot lebkowski+php at gmail dot com | Date: | Thu, 03 Aug 2006 08:58:17 +0000 |
| Subject: | note 68605 added to function.reset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115506@lists.php.net to get a copy of this message | ||
Colin, there`s a better (IMO) way to solve your problem.
<?
// ...
foreach($a as $k => &$d){} // notice the "&"
// ...
?>
It
s a new feature in PHP5 to use references in foreach loop. This way PHP isnt making a
copy of the array, so the internal pointer won`t be reset.
----
Server IP: 195.136.184.34
Probable Submitter: 83.15.34.206
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.reset.php
Edit -- https://master.php.net/note/edit/68605
Del: integrated -- https://master.php.net/note/delete/68605/integrated
Del: useless -- https://master.php.net/note/delete/68605/useless
Del: bad code -- https://master.php.net/note/delete/68605/bad+code
Del: spam -- https://master.php.net/note/delete/68605/spam
Del: non-english -- https://master.php.net/note/delete/68605/non-english
Del: in docs -- https://master.php.net/note/delete/68605/in+docs
Del: other reasons-- https://master.php.net/note/delete/68605
Reject -- https://master.php.net/note/reject/68605
Search -- https://master.php.net/manage/user-notes.php