Moriyoshi Koizumi wrote:
I tried to answer this question in the bug report page.
[...]
1) Each time before entering a foreach loop, php first tries to make a copy of
the array being iterated.
2) In case the array variable is either referenceing another variable or
referenced by another
On Wed, Jan 22, 2003 at 04:12:18PM +0100, Vaclav Dvorak wrote:
Moriyoshi Koizumi wrote:
I tried to answer this question in the bug report page.
[...]
1) Each time before entering a foreach loop, php first tries to make a
copy of
the array being iterated.
2) In case the array variable
Moriyoshi Koizumi wrote:
Moriyoshi Koizumi wrote:
1) Each time before entering a foreach loop, php first tries to make a
copy of
the array being iterated.
2) In case the array variable is either referenceing another variable or
referenced by another variable, no copy is made here and the
To answer part of your question:
One more thing: whether this bug is fixed or not, the
documentation must
be clarified! I don't know about you, but I simply don't
understand what
it's supposed to say. Quoting: Note: Also note that foreach operates
What the documentation means is that
Hi,
?php
$a = array(1,2,3);
#$r = $a;
echo current before foreach: . current($a) . br\n;
foreach($a as $b) {
echo - value in cycle: . $b . br\n;
echo -- current in cycle: . current($a) . br\n;
}
echo current before foreach: . current($a) . br\n;
?
Try it, and the delete
Ah, I understand now... This perhaps in a documentation problem then
after all, as there is no way to change this behavior cleanly that I can
see... What about making a copy of the array and all of the references
associated with that array instead of just using the real array?
Just a thought.
Just FYI, here's a relevant commit made by Andi two years ago:
http://cvs.php.net/diff.php/Zend/zend_execute.c?r1=1.222r2=1.223ty=h
Moriyoshi
John Coggeshall [EMAIL PROTECTED] wrote:
Ah, I understand now... This perhaps in a documentation problem then
after all, as there is no way to change