3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( array("one" => array("a"=>"0000", "b"=>"1111")), ); foreach($a as &$record) { $record["one"]["a"] = "2222"; } var_dump($a); var_dump(str_replace("2", "3", $a));
Output for 8.0.0 - 8.0.20, 8.1.0 - 8.1.7
array(1) { [0]=> &array(1) { ["one"]=> array(2) { ["a"]=> string(4) "2222" ["b"]=> string(4) "1111" } } } Warning: Array to string conversion in /in/iOlfo on line 14 array(1) { [0]=> string(5) "Array" }
Output for 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.6 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.30
array(1) { [0]=> &array(1) { ["one"]=> array(2) { ["a"]=> string(4) "2222" ["b"]=> string(4) "1111" } } } array(1) { [0]=> array(1) { ["one"]=> array(2) { ["a"]=> string(4) "2222" ["b"]=> string(4) "1111" } } }
Output for 7.0.0 - 7.0.5
array(1) { [0]=> &array(1) { ["one"]=> array(2) { ["a"]=> string(4) "2222" ["b"]=> string(4) "1111" } } } Notice: Array to string conversion in /in/iOlfo on line 14 array(1) { [0]=> string(5) "Array" }

preferences:
38.74 ms | 412 KiB | 5 Q