note 31455 modified in control-structures.foreach by alindeman
| From: | alindeman@php.net | Date: | Tue, 22 Apr 2003 20:45:42 +0000 |
| Subject: | note 31455 modified in control-structures.foreach by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-46949@lists.php.net to get a copy of this message | ||
[Ed Note: You can also use array_keys() so that you don't have to have the $value_copy
variable --alindeman at php.net]
I use the following to modify the original values of the array:
foreach ($array as $key=>$value_copy)
{
$value =& $array[$key];
...
$value = 'New Value';
}
--was--
I use the following to modify the original values of the array:
foreach ($array as $key=>$value_copy)
{
$value =& $array[$key];
...
$value = 'New Value';
}
http://www.php.net/manual/en/control-structures.foreach.php