3v4l.org

run code in 300+ PHP versions simultaneously
<?php function returns_null(): ?string { return; // Fatal error: A void function must not return a value } try { returns_null(); echo "OK!"; } catch (Error $e) { echo "Error:"; var_dump($e); }
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.32, 7.4.0 - 7.4.25, 8.0.0 - 8.0.12
Fatal error: A function with return type must return a value (did you mean "return null;" instead of "return;"?) in /in/7HscE on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.33
Parse error: syntax error, unexpected '?' in /in/7HscE on line 3
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Parse error: syntax error, unexpected ':', expecting '{' in /in/7HscE on line 3
Process exited with code 255.

preferences:
292.56 ms | 1386 KiB | 221 Q