3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.3.0 - 8.3.4
Warning: Trying to access array offset on null in /in/qIEJJ on line 14 Warning: Trying to access array offset on null in /in/qIEJJ on line 14 Warning: Undefined array key "nope" in /in/qIEJJ on line 16 Warning: Undefined array key "nope" in /in/qIEJJ on line 17 Warning: Trying to access array offset on null in /in/qIEJJ on line 17 Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/qIEJJ:19 Stack trace: #0 {main} thrown in /in/qIEJJ on line 19
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
Warning: Trying to access array offset on value of type null in /in/qIEJJ on line 14 Warning: Trying to access array offset on value of type null in /in/qIEJJ on line 14 Warning: Undefined array key "nope" in /in/qIEJJ on line 16 Warning: Undefined array key "nope" in /in/qIEJJ on line 17 Warning: Trying to access array offset on value of type null in /in/qIEJJ on line 17 Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/qIEJJ:19 Stack trace: #0 {main} thrown in /in/qIEJJ on line 19
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Notice: Trying to access array offset on value of type null in /in/qIEJJ on line 14 Notice: Trying to access array offset on value of type null in /in/qIEJJ on line 14 Notice: Undefined index: nope in /in/qIEJJ on line 16 Notice: Undefined index: nope in /in/qIEJJ on line 17 Notice: Trying to access array offset on value of type null in /in/qIEJJ on line 17 Warning: Illegal string offset 'nope' in /in/qIEJJ on line 19 s Warning: Illegal string offset 'nope' in /in/qIEJJ on line 20 Warning: Illegal string offset 'sure' in /in/qIEJJ on line 20 s Notice: Trying to access array offset on value of type int in /in/qIEJJ on line 22 Notice: Trying to access array offset on value of type int in /in/qIEJJ on line 23 Notice: Trying to access array offset on value of type null in /in/qIEJJ on line 23 Notice: Trying to access array offset on value of type float in /in/qIEJJ on line 25 Notice: Trying to access array offset on value of type float in /in/qIEJJ on line 26 Notice: Trying to access array offset on value of type null in /in/qIEJJ on line 26 Notice: Trying to access array offset on value of type bool in /in/qIEJJ on line 28 Notice: Trying to access array offset on value of type bool in /in/qIEJJ on line 29 Notice: Trying to access array offset on value of type null in /in/qIEJJ on line 29 Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/qIEJJ:31 Stack trace: #0 {main} thrown in /in/qIEJJ on line 31
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Notice: Undefined index: nope in /in/qIEJJ on line 16 Notice: Undefined index: nope in /in/qIEJJ on line 17 Warning: Illegal string offset 'nope' in /in/qIEJJ on line 19 s Warning: Illegal string offset 'nope' in /in/qIEJJ on line 20 Warning: Illegal string offset 'sure' in /in/qIEJJ on line 20 s Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/qIEJJ:31 Stack trace: #0 {main} thrown in /in/qIEJJ on line 31
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Notice: Undefined index: nope in /in/qIEJJ on line 16 Notice: Undefined index: nope in /in/qIEJJ on line 17 Warning: Illegal string offset 'nope' in /in/qIEJJ on line 19 s Warning: Illegal string offset 'nope' in /in/qIEJJ on line 20 Warning: Illegal string offset 'sure' in /in/qIEJJ on line 20 s Fatal error: Cannot use object of type stdClass as array in /in/qIEJJ on line 31
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Notice: Undefined index: nope in /in/qIEJJ on line 16 Notice: Undefined index: nope in /in/qIEJJ on line 17 s Fatal error: Cannot use string offset as an array in /in/qIEJJ on line 20
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Notice: Undefined index: nope in /in/qIEJJ on line 16 Notice: Undefined index: nope in /in/qIEJJ on line 17 s Fatal error: Cannot use string offset as an array in /in/qIEJJ on line 20
Process exited with code 255.
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
Notice: Undefined index: nope in /in/qIEJJ on line 16 Notice: Undefined index: nope in /in/qIEJJ on line 17 s

preferences:
278.5 ms | 401 KiB | 456 Q