note 58920 added to control-structures.foreach
| From: | someguy at osu1 dot php dot net | Date: | Sun, 20 Nov 2005 18:25:14 +0000 |
| Subject: | note 58920 added to control-structures.foreach | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-98859@lists.php.net to get a copy of this message | ||
ADMINISTRATORS: there is a stray ampersand in the second line of the first code example, right
before the $value variable:
<?php
$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
$value = $value * 2;
}
// $arr is now array(2, 4, 6, 8)
?>
the code should be:
<?php
$arr = array(1, 2, 3, 4);
foreach ($arr as $value) {
$value = $value * 2;
}
// $arr is now array(2, 4, 6, 8)
?>
----
Manual Page -- http://www.php.net/manual/en/control-structures.foreach.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58920
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58920&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58920&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58920&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58920&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58920&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58920&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58920&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58920&report=yes
Search -- http://master.php.net/manage/user-notes.php