Re: [PHP] foreach() using current() strange beahvior

2007-06-24 Thread Julien Pauli
Don't worry I know how variable work internaly into Zend Engine ( for those who want more info, Derick Rethan's got a good pdf file explaining that process here : http://derickrethans.nl/files/phparch-php-variables-article.pdf , Derick, if you here us, feel free to come in that conversation ;-) )

Re: [PHP] foreach() using current() strange beahvior

2007-06-23 Thread Nathan Nobbe
Julien, i reproduced your experiment and got a different result on the first one. i found that the internal pointer does not seem to be affected if there is a check on the index of the internal pointer during iteration, but if there is no check on the index during iteration the pointer seems to

Re: [PHP] foreach() using current() strange beahvior

2007-06-23 Thread Robert Cummings
On Sat, 2007-06-23 at 19:15 +0200, Julien Pauli wrote: Please consider this code : ?php $a = array(One,Two,Three); foreach ($a AS $k=$v) { } var_dump(current($a)); // outputs boll(false); that's expected as foreach moves the internal array pointer, it's documented. now consider

Re: [PHP] foreach() using current() strange beahvior

2007-06-23 Thread Robert Cummings
On Sat, 2007-06-23 at 15:15 -0400, Nathan Nobbe wrote: in summary, COW or not; i think the documentation could be revised a bit to clarify these subtleties. Regardless of additional documentation or not, I think it's rather poor choice of programming style to mix the foreach construct with the

[PHP] foreach() using current() strange beahvior

2007-06-23 Thread Julien Pauli
Please consider this code : ?php $a = array(One,Two,Three); foreach ($a AS $k=$v) { } var_dump(current($a)); // outputs boll(false); that's expected as foreach moves the internal array pointer, it's documented. now consider this : ?php $a = array(One,Two,Three); foreach ($a AS $k=$v) {

Re: [PHP] foreach() using current() strange beahvior

2007-06-23 Thread Nathan Nobbe
On 6/23/07, Robert Cummings [EMAIL PROTECTED] wrote: Regardless of additional documentation or not, I think it's rather poor choice of programming style to mix the foreach construct with the older, lower level, internal array manipulation and probing functions. I think that is what should be