3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function rechne(?string $test): ?int { return $test; } var_dump(rechne(null)); var_dump(rechne("str"));
based on cJFCM
Output for 7.1.0
NULL Fatal error: Uncaught TypeError: Return value of rechne() must be of the type integer or null, string returned in /in/1o9rj:4 Stack trace: #0 /in/1o9rj(8): rechne('str') #1 {main} thrown in /in/1o9rj on line 4
Process exited with code 255.
Output for 5.6.0 - 7.0.13
Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /in/1o9rj on line 3
Process exited with code 255.