PHP odds! today: pass by reference traps

This is dangerous:

//example array
$array = array('a' => array(array(243,453,435,232)));

foreach ($array['a'] as &$value) {
         $value[3] = $newvalue;

This works, but now the $value var is in the array by reference which can lateron lead to:
Notice: Array to string conversion
see below in the comments for when…

This works better:

Using reference, array_walk und lambda functions works:

array_walk($array[$key], function(&$value, $key, $newvalue) {
                                   $value[3] = $newvalue;

or that (thanks lars):

foreach ($array['a'] as $k => $value) {
         $array['a'][$k][3] = $newvalue;