note 109454 deleted from control-structures.foreach by danbrown
| From: | danbrown@php.net | Date: | Fri, 20 Jul 2012 15:29:43 +0000 |
| Subject: | note 109454 deleted from control-structures.foreach by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189337@lists.php.net to get a copy of this message | ||
Note Submitter: dhumes
----
This is because arrays are always references. When you get the value in a foreach and that value is
an array, you actually get a copy of the REFERENCE to the array. So when you modify a nested array
using foreach you are actually modifying the nested array.