|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-03-18 06:14 UTC] jidanni at jidanni dot org
Description:
------------
In php-doc/html/control-structures.foreach.html
be sure to please mention that you can do
$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
$value = $value * 2;
}
and
foreach (array(1, 2, 3, 4) as $value) {
$value = $value * 2;
}
but not
foreach (array(1, 2, 3, 4) as &$value) {
$value = $value * 2;
}
!
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 03:00:02 2026 UTC |
Yes, an example is worth a thousand words. And even use something like foreach(array($bla['a']['b']['c']) as $x){if(4==$x){$x=...}else... where we even just have one member, and use foreach to make our program more readable, but ... just ... can't.