3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = function (int $a = null) : int { $a = 1; if ($a == 2) {return $a;} return null; }; $a();
based on ra3DT
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Return value of {closure}() must be of the type integer, null returned in /in/eVYAl:3 Stack trace: #0 /in/eVYAl(5): {closure}() #1 {main} thrown in /in/eVYAl on line 3
Process exited with code 255.
Output for 5.3.22 - 5.6.28
Parse error: syntax error, unexpected ':', expecting '{' in /in/eVYAl on line 3
Process exited with code 255.