3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = ""; $str[] = "b"; var_dump($str); $str = "a"; $str[0] = "b"; var_dump($str); $str = "a"; $str[1] = "b"; var_dump($str);
based on S7Hv9
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught Error: [] operator not supported for strings in /in/45n6Z:4 Stack trace: #0 {main} thrown in /in/45n6Z on line 4
Process exited with code 255.
Output for 5.3.21 - 7.0.20
array(1) { [0]=> string(1) "b" } string(1) "b" string(2) "ab"