3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = ""; $a[] = "y"; var_dump($a); $b = "x"; $b[] = "y"; var_dump($b);
based on 9dpbU
Output for 7.1.0
Fatal error: Uncaught Error: [] operator not supported for strings in /in/vg7Oe:2 Stack trace: #0 {main} thrown in /in/vg7Oe on line 2
Process exited with code 255.
Output for 7.0.0 - 7.0.14
array(1) { [0]=> string(1) "y" } Fatal error: Uncaught Error: [] operator not supported for strings in /in/vg7Oe:3 Stack trace: #0 {main} thrown in /in/vg7Oe on line 3
Process exited with code 255.
Output for hhvm-3.12.0
array(1) { [0]=> string(1) "y" } Fatal error: Uncaught Error: [] operator not supported for strings in /in/vg7Oe:3 Stack trace: #0 {main}
Process exited with code 255.
Output for 4.3.2 - 5.6.28, hhvm-3.10.0
array(1) { [0]=> string(1) "y" } Fatal error: [] operator not supported for strings in /in/vg7Oe on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
array(1) { [0]=> string(1) "y" } Fatal error: [] operator not supported for strings in /in/vg7Oe on line 3