<?php $a = [1, 2, 3]; foreach ($a as $k => &$v) { $v *= 2; } var_dump($a); // Tudo normal, $v = null; var_dump($a);
Standard input is empty
array(3) { [0]=> int(2) [1]=> int(4) [2]=> &int(6) } array(3) { [0]=> int(2) [1]=> int(4) [2]=> &NULL }
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!