3v4l.org

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