note 9465 deleted from control-structures.foreach by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 18 Aug 2004 19:31:09 +0000 |
| Subject: | note 9465 deleted from control-structures.foreach by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74910@lists.php.net to get a copy of this message | ||
Note Submitter: dschultz at protonic dot com
----
As was mentioned, foreach does not modify the original array, but that's easily worked around:
foreach($arr as $key => $value)
$arr[$key] = $value+3;
This snippet will increment each element of an array by 3.