3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo(string $test = null) { echo 'foo ok'; } function bar(string $test) { echo 'bar ok'; } foo(null); bar(null);
based on Wh71Y
Output for 7.0.0 - 7.2.0
foo ok Fatal error: Uncaught TypeError: Argument 1 passed to bar() must be of the type string, null given, called in /in/ndq0E on line 7 and defined in /in/ndq0E:4 Stack trace: #0 /in/ndq0E(7): bar(NULL) #1 {main} thrown in /in/ndq0E on line 4
Process exited with code 255.
Output for 5.3.21 - 5.6.28
foo ok Catchable fatal error: Argument 1 passed to bar() must be an instance of string, null given, called in /in/ndq0E on line 7 and defined in /in/ndq0E on line 4
Process exited with code 255.