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']; $null['nope'][] = 'wat!?!'; echo $null['nope'][0]; echo $arr['nope']; echo $arr['nope']['sure']; $arr['nope'][] = 'wat!?!'; echo $arr['nope'][0]; echo $str['nope']; echo $str['nope']['sure']; $str['nope'][] = 'wat!?!'; echo $str['nope'][0]; echo $int['nope']; echo $int['nope']['sure']; $int['nope'][] = 'wat!?!'; echo $int['nope'][0]; echo $dbl['nope']; echo $dbl['nope']['sure']; $dbl['nope'][] = 'wat!?!'; echo $dbl['nope'][0]; echo $bool['nope']; echo $bool['nope']['sure']; $bool['nope'][] = 'wat!?!'; echo $bool['nope'][0]; echo $obj['nope']; echo $obj['nope']['sure']; $obj['nope'][] = 'wat!?!'; echo $obj['nope'][0];
Output for 8.3.0 - 8.3.7
Warning: Trying to access array offset on null in /in/GBEkc on line 13 Warning: Trying to access array offset on null in /in/GBEkc on line 14 Warning: Trying to access array offset on null in /in/GBEkc on line 14 wat!?! Warning: Undefined array key "nope" in /in/GBEkc on line 18 Warning: Undefined array key "nope" in /in/GBEkc on line 19 Warning: Trying to access array offset on null in /in/GBEkc on line 19 wat!?! Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/GBEkc:23 Stack trace: #0 {main} thrown in /in/GBEkc on line 23
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Warning: Trying to access array offset on value of type null in /in/GBEkc on line 13 Warning: Trying to access array offset on value of type null in /in/GBEkc on line 14 Warning: Trying to access array offset on value of type null in /in/GBEkc on line 14 wat!?! Warning: Undefined array key "nope" in /in/GBEkc on line 18 Warning: Undefined array key "nope" in /in/GBEkc on line 19 Warning: Trying to access array offset on value of type null in /in/GBEkc on line 19 wat!?! Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /in/GBEkc:23 Stack trace: #0 {main} thrown in /in/GBEkc on line 23
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/GBEkc on line 13 Notice: Trying to access array offset on value of type null in /in/GBEkc on line 14 Notice: Trying to access array offset on value of type null in /in/GBEkc on line 14 wat!?! Notice: Undefined index: nope in /in/GBEkc on line 18 Notice: Undefined index: nope in /in/GBEkc on line 19 Notice: Trying to access array offset on value of type null in /in/GBEkc on line 19 wat!?! Warning: Illegal string offset 'nope' in /in/GBEkc on line 23 s Warning: Illegal string offset 'nope' in /in/GBEkc on line 24 Warning: Illegal string offset 'sure' in /in/GBEkc on line 24 s Warning: Illegal string offset 'nope' in /in/GBEkc on line 25 Fatal error: Uncaught Error: Cannot use string offset as an array in /in/GBEkc:25 Stack trace: #0 {main} thrown in /in/GBEkc on line 25
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
wat!?! Notice: Undefined index: nope in /in/GBEkc on line 18 Notice: Undefined index: nope in /in/GBEkc on line 19 wat!?! Warning: Illegal string offset 'nope' in /in/GBEkc on line 23 s Warning: Illegal string offset 'nope' in /in/GBEkc on line 24 Warning: Illegal string offset 'sure' in /in/GBEkc on line 24 s Warning: Illegal string offset 'nope' in /in/GBEkc on line 25 Fatal error: Uncaught Error: Cannot use string offset as an array in /in/GBEkc:25 Stack trace: #0 {main} thrown in /in/GBEkc on line 25
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
wat!?! Notice: Undefined index: nope in /in/GBEkc on line 18 Notice: Undefined index: nope in /in/GBEkc on line 19 wat!?! Warning: Illegal string offset 'nope' in /in/GBEkc on line 23 s Warning: Illegal string offset 'nope' in /in/GBEkc on line 24 Warning: Illegal string offset 'sure' in /in/GBEkc on line 24 s Warning: Illegal string offset 'nope' in /in/GBEkc on line 25 Fatal error: Cannot use string offset as an array in /in/GBEkc on line 25
Process exited with code 255.
Output for 5.3.0 - 5.3.29
wat!?! Notice: Undefined index: nope in /in/GBEkc on line 18 Notice: Undefined index: nope in /in/GBEkc on line 19 wat!?!s Fatal error: Cannot use string offset as an array in /in/GBEkc on line 24
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
wat!?! Notice: Undefined index: nope in /in/GBEkc on line 18 Notice: Undefined index: nope in /in/GBEkc on line 19 wat!?!s Fatal error: Cannot use string offset as an array in /in/GBEkc on line 24
Process exited with code 255.
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9
wat!?! Notice: Undefined index: nope in /in/GBEkc on line 18 Notice: Undefined index: nope in /in/GBEkc on line 19 wat!?!s Warning: Cannot use a scalar value as an array in /in/GBEkc on line 30 Warning: Cannot use a scalar value as an array in /in/GBEkc on line 35 Warning: Cannot use a scalar value as an array in /in/GBEkc on line 40 Warning: Cannot use a scalar value as an array in /in/GBEkc on line 45

preferences:
327.78 ms | 402 KiB | 455 Q