note 47090 added to function.each
| From: | james at gogo dot co dot nz | Date: | Tue, 02 Nov 2004 15:29:55 +0000 |
| Subject: | note 47090 added to function.each | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79507@lists.php.net to get a copy of this message | ||
It's worth noting that references to an array don't have thier own array pointer, and
taking a reference to an array doesn't reset it's array pointer, so this works as you
would expect it would by eaching the first three items of the array, rather than the first item 3
times.
<?php
$x = array(1,2,3);
print_r(each($x));
echo "\n";
$y =& $x;
print_r(each($y));
echo "\n";
$z =& $y;
print_r(each($z));
echo "\n";
?>
----
Manual Page -- http://www.php.net/manual/en/function.each.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47090
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47090&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47090&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47090&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47090&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47090&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47090&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47090&report=yes
Search -- http://master.php.net/manage/user-notes.php