3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $var[] = 'I work'; var_dump($var); $a[] = 'Me too'; var_dump($a); $b = 'Foo'; $b = array(); $b[] = 'So do I'; var_dump($b); $c = 'Bar'; $c[] = 'I don\'t :\\'; var_dump($c);
based on t762M
Output for 7.0.0 - 7.2.0
array(1) { [0]=> string(6) "I work" } array(1) { [0]=> string(6) "Me too" } array(1) { [0]=> string(7) "So do I" } Fatal error: Uncaught Error: [] operator not supported for strings in /in/8KMvt:15 Stack trace: #0 {main} thrown in /in/8KMvt on line 15
Process exited with code 255.
Output for 5.3.21 - 5.6.28
array(1) { [0]=> string(6) "I work" } array(1) { [0]=> string(6) "Me too" } array(1) { [0]=> string(7) "So do I" } Fatal error: [] operator not supported for strings in /in/8KMvt on line 15
Process exited with code 255.