3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(): null { $a = 42; } var_dump(foo());
Output for 8.2.22 - 8.2.29, 8.3.5 - 8.3.25, 8.4.1 - 8.4.12
Fatal error: Uncaught TypeError: foo(): Return value must be of type null, none returned in /in/Y9ZCO:5 Stack trace: #0 /in/Y9ZCO(7): foo() #1 {main} thrown in /in/Y9ZCO on line 5
Process exited with code 255.
Output for 8.0.0 - 8.0.7, 8.1.8 - 8.1.33
Fatal error: Null can not be used as a standalone type in /in/Y9ZCO on line 3
Process exited with code 255.
Output for 7.3.0 - 7.3.28, 7.4.0 - 7.4.20
Fatal error: Cannot use 'null' as class name as it is reserved in /in/Y9ZCO on line 3
Process exited with code 255.

preferences:
60.24 ms | 408 KiB | 5 Q