3v4l.org

run code in 300+ PHP versions simultaneously
<?php $oldArr = [ [ "color" => "red", "shape" => "circle", "size" => "small", ], [ "color" => "green", "shape" => "square", "size" => "large", ], [ "color" => "yellow", "shape" => "triangle", "size" => "large", ], ]; $newVals = ["large", "large", "small"]; foreach ($oldArr as $i => ['size' => &$size]) { $size = $newVals[$i]; } var_export($oldArr);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
array ( 0 => array ( 'color' => 'red', 'shape' => 'circle', 'size' => 'large', ), 1 => array ( 'color' => 'green', 'shape' => 'square', 'size' => 'large', ), 2 => array ( 'color' => 'yellow', 'shape' => 'triangle', 'size' => 'small', ), )

preferences:
62.62 ms | 403 KiB | 91 Q