3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array(); $array['foo'] = 'bar'; $array['foo']['bar'] = 'baz'; print_r($array); $array['foo']['bar'] = 2; $array['foo'] = 1; print_r($array);
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: Illegal string offset 'bar' in /in/8R0oX on line 5 Array ( [foo] => bar ) Warning: Illegal string offset 'bar' in /in/8R0oX on line 9 Array ( [foo] => 1 )
Output for 4.3.0 - 5.3.29, hhvm-3.10.0 - 3.12.0
Array ( [foo] => bar ) Array ( [foo] => 1 )