3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test(int $x = null) { var_export($x); } test(1); test(null); test('x');
based on sXN9o
Output for 7.1.0 - 7.2.0
1NULL Fatal error: Uncaught TypeError: Argument 1 passed to test() must be of the type integer or null, string given, called in /in/5SGUh on line 7 and defined in /in/5SGUh:3 Stack trace: #0 /in/5SGUh(7): test('x') #1 {main} thrown in /in/5SGUh on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.20
1NULL Fatal error: Uncaught TypeError: Argument 1 passed to test() must be of the type integer, string given, called in /in/5SGUh on line 7 and defined in /in/5SGUh:3 Stack trace: #0 /in/5SGUh(7): test('x') #1 {main} thrown in /in/5SGUh on line 3
Process exited with code 255.
Output for 5.3.22 - 5.6.21
Catchable fatal error: Argument 1 passed to test() must be an instance of int, integer given, called in /in/5SGUh on line 5 and defined in /in/5SGUh on line 3
Process exited with code 255.