Re: cvs: phpdoc /en/language control-structures.xml
| From: | Etienne Kneuss | Date: | Mon, 12 Nov 2007 18:10:14 +0000 |
| Subject: | Re: cvs: phpdoc /en/language control-structures.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-380@lists.php.net to get a copy of this message | ||
Hi Nuno,
First of all, the description in place was incorrect (or at least not
complete), foreach's behavior
on array pointer cannot be described in a few lines as it implies too much
magic, it depends whether
the array itself is used (and how it's used) inside the foreach or not, as
foreach will do some optimization if it's not.
$array = array(0,1,2,3); foreach($array as $a){} var_dump(key($array)); //
NULL, as described in the doc
however:
$array = array(0,1,2,3); foreach($array as $a){ current($array); }
var_dump(key($array)); // int(1);
the pointer in such cases is only moved once. Worse:
$array = array(0,1,2,3); foreach($array as $a){ $c = $array; }
var_dump(key($array)); // int(0);
here it's not moved.
Increasing the complexity of the doc about a subject that is quite
depreciated (array pointers)
seemed not worth the trouble.
The typo is fixed though, thanks for the hint
> I don't understand how your "fix" is better than the wording that was
there.
> It was much more explicit for those who want to know what's going on.
> Anyway, you have a typo in your commit (effets).
> Nuno
--
Etienne Kneuss
http://www.colder.ch
Men never do evil so completely and cheerfully as
when they do it from a religious conviction.
-- Pascal