3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(-1); $null = null; $arr = array(); $str = 'string'; $int = 7; $dbl = 7.3; $bool = true; $obj = new stdClass(); echo $null['nope']; echo $null['nope']['sure']; echo $arr['nope']; echo $arr['nope']['sure']; echo $str['nope']; echo $str['nope']['sure']; echo $int['nope']; echo $int['nope']['sure']; echo $dbl['nope']; echo $dbl['nope']['sure']; echo $bool['nope']; echo $bool['nope']['sure']; echo $obj['nope']; echo $obj['nope']['sure'];
Output for 7.0.0 - 7.1.0
Notice: Undefined index: nope in /in/dNmX4 on line 16 Notice: Undefined index: nope in /in/dNmX4 on line 17 Warning: Illegal string offset 'nope' in /in/dNmX4 on line 19 s Warning: Illegal string offset 'nope' in /in/dNmX4 on line 20 Warning: Illegal string offset 'sure' in /in/dNmX4 on line 20 s Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/dNmX4:31 Stack trace: #0 {main} thrown in /in/dNmX4 on line 31
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Notice: Undefined index: nope in /in/dNmX4 on line 16 Notice: Undefined index: nope in /in/dNmX4 on line 17 Warning: Illegal string offset 'nope' in /in/dNmX4 on line 19 s Warning: Illegal string offset 'nope' in /in/dNmX4 on line 20 Warning: Illegal string offset 'sure' in /in/dNmX4 on line 20 s Fatal error: Cannot use object of type stdClass as array in /in/dNmX4 on line 31
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Notice: Undefined index: nope in /in/dNmX4 on line 16 Notice: Undefined index: nope in /in/dNmX4 on line 17 s Fatal error: Cannot use string offset as an array in /in/dNmX4 on line 20
Process exited with code 255.
Output for 5.0.0 - 5.2.17
Notice: Undefined index: nope in /in/dNmX4 on line 16 Notice: Undefined index: nope in /in/dNmX4 on line 17 s Fatal error: Cannot use string offset as an array in /in/dNmX4 on line 20
Process exited with code 255.
Output for 4.3.0 - 4.4.9
Notice: Undefined index: nope in /in/dNmX4 on line 16 Notice: Undefined index: nope in /in/dNmX4 on line 17 s