note 58920 rejected from control-structures.foreach by dmytton
| From: | dmytton@php.net | Date: | Sun, 20 Nov 2005 18:35:38 +0000 |
| Subject: | note 58920 rejected from control-structures.foreach by dmytton | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-98860@lists.php.net to get a copy of this message | ||
Note Submitter: some guy
----
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)
?>