fork download
  1. <?php
  2.  
  3. $a = [1, 2, 3];
  4.  
  5. foreach ($a as $k => &$v) {
  6. $v *= 2;
  7. }
  8.  
  9.  
  10. var_dump($a); // Tudo normal,
  11.  
  12.  
  13. $v = null;
  14.  
  15.  
Success #stdin #stdout 0s 52488KB
stdin
Standard input is empty
stdout
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(4)
  [2]=>
  &int(6)
}
array(3) {
  [0]=>
  int(2)
  [1]=>
  int(4)
  [2]=>
  &NULL
}