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(); var_dump($null['nope']); var_dump($null['nope']['sure']); var_dump($arr['nope']); var_dump($arr['nope']['sure']); var_dump($str['nope']); var_dump($str['nope']['sure']); var_dump($int['nope']); var_dump($int['nope']['sure']); var_dump($dbl['nope']); var_dump($dbl['nope']['sure']); var_dump($bool['nope']); var_dump($bool['nope']['sure']); var_dump($obj['nope']); var_dump($obj['nope']['sure']);
Output for 7.0.0 - 7.1.0
NULL NULL Notice: Undefined index: nope in /in/ie8Ok on line 16 NULL Notice: Undefined index: nope in /in/ie8Ok on line 17 NULL Warning: Illegal string offset 'nope' in /in/ie8Ok on line 19 string(1) "s" Warning: Illegal string offset 'nope' in /in/ie8Ok on line 20 Warning: Illegal string offset 'sure' in /in/ie8Ok on line 20 string(1) "s" NULL NULL NULL NULL NULL NULL Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/ie8Ok:31 Stack trace: #0 {main} thrown in /in/ie8Ok on line 31
Process exited with code 255.
Output for 5.4.0 - 5.6.28
NULL NULL Notice: Undefined index: nope in /in/ie8Ok on line 16 NULL Notice: Undefined index: nope in /in/ie8Ok on line 17 NULL Warning: Illegal string offset 'nope' in /in/ie8Ok on line 19 string(1) "s" Warning: Illegal string offset 'nope' in /in/ie8Ok on line 20 Warning: Illegal string offset 'sure' in /in/ie8Ok on line 20 string(1) "s" NULL NULL NULL NULL NULL NULL Fatal error: Cannot use object of type stdClass as array in /in/ie8Ok on line 31
Process exited with code 255.
Output for 5.3.0 - 5.3.29
NULL NULL Notice: Undefined index: nope in /in/ie8Ok on line 16 NULL Notice: Undefined index: nope in /in/ie8Ok on line 17 NULL string(1) "s" Fatal error: Cannot use string offset as an array in /in/ie8Ok on line 20
Process exited with code 255.
Output for 5.0.0 - 5.2.17
NULL NULL Notice: Undefined index: nope in /in/ie8Ok on line 16 NULL Notice: Undefined index: nope in /in/ie8Ok on line 17 NULL string(1) "s" Fatal error: Cannot use string offset as an array in /in/ie8Ok on line 20
Process exited with code 255.
Output for 4.3.0 - 4.4.9
NULL NULL Notice: Undefined index: nope in /in/ie8Ok on line 16 NULL Notice: Undefined index: nope in /in/ie8Ok on line 17 NULL string(1) "s" NULL NULL NULL NULL NULL NULL NULL NULL NULL