3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $foo = 'string'; echo $foo['foo']; echo '<hr>'; $foo = array(); echo $foo['foo']; echo '<hr>'; echo $foo[2]; echo '<hr>';
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: Illegal string offset 'foo' in /in/TcTpY on line 4 s<hr> Notice: Undefined index: foo in /in/TcTpY on line 8 <hr> Notice: Undefined offset: 2 in /in/TcTpY on line 11 <hr>
Output for hhvm-3.10.0 - 3.12.0
s<hr> Notice: Undefined index: foo in /in/TcTpY on line 8 <hr> Notice: Undefined index: 2 in /in/TcTpY on line 11 <hr>
Output for 5.3.0 - 5.3.29
s<hr> Notice: Undefined index: foo in /in/TcTpY on line 8 <hr> Notice: Undefined offset: 2 in /in/TcTpY on line 11 <hr>
Output for 4.3.0 - 5.2.17
s<hr> Notice: Undefined index: foo in /in/TcTpY on line 8 <hr> Notice: Undefined offset: 2 in /in/TcTpY on line 11 <hr>