3v4l.org

run code in 300+ PHP versions simultaneously
<?php $int = 42; $float = 42.1234; $bool = true; $resource = fopen('php://stdout', 'w'); $null = null; $string = 'Foo bar'; $object = new \stdClass(); var_dump($int[1]); var_dump($float[1]); var_dump($bool[1]); var_dump($resource[1]); var_dump($null[1]); var_dump($string[1]); var_dump($object[1]);
Output for 8.3.0 - 8.3.13
Warning: Trying to access array offset on int in /in/D3c2q on line 11 NULL Warning: Trying to access array offset on float in /in/D3c2q on line 12 NULL Warning: Trying to access array offset on true in /in/D3c2q on line 13 NULL Warning: Trying to access array offset on resource in /in/D3c2q on line 14 NULL Warning: Trying to access array offset on null in /in/D3c2q on line 15 NULL string(1) "o" Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/D3c2q:17 Stack trace: #0 {main} thrown in /in/D3c2q on line 17
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25
Warning: Trying to access array offset on value of type int in /in/D3c2q on line 11 NULL Warning: Trying to access array offset on value of type float in /in/D3c2q on line 12 NULL Warning: Trying to access array offset on value of type bool in /in/D3c2q on line 13 NULL Warning: Trying to access array offset on value of type resource in /in/D3c2q on line 14 NULL Warning: Trying to access array offset on value of type null in /in/D3c2q on line 15 NULL string(1) "o" Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/D3c2q:17 Stack trace: #0 {main} thrown in /in/D3c2q on line 17
Process exited with code 255.
Output for 7.4.26 - 7.4.33
Notice: Trying to access array offset on value of type int in /in/D3c2q on line 11 NULL Notice: Trying to access array offset on value of type float in /in/D3c2q on line 12 NULL Notice: Trying to access array offset on value of type bool in /in/D3c2q on line 13 NULL Notice: Trying to access array offset on value of type resource in /in/D3c2q on line 14 NULL Notice: Trying to access array offset on value of type null in /in/D3c2q on line 15 NULL string(1) "o" Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/D3c2q:17 Stack trace: #0 {main} thrown in /in/D3c2q on line 17
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.25
NULL NULL NULL NULL NULL string(1) "o" Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/D3c2q:17 Stack trace: #0 {main} thrown in /in/D3c2q on line 17
Process exited with code 255.
Output for 5.6.0 - 5.6.40
NULL NULL NULL NULL NULL string(1) "o" Fatal error: Cannot use object of type stdClass as array in /in/D3c2q on line 17
Process exited with code 255.

preferences:
80.96 ms | 412 KiB | 5 Q