3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Karel {} function foo(Karel $karel = null, ?integer $int){ return $karel . $int; } echo foo(null, 2);
based on fZgse
Output for 7.3.0alpha1
Fatal error: Uncaught TypeError: Argument 2 passed to foo() must be an instance of integer or null, int given, called in /in/hWRQc on line 9 and defined in /in/hWRQc:5 Stack trace: #0 /in/hWRQc(9): foo(NULL, 2) #1 {main} thrown in /in/hWRQc on line 5
Process exited with code 255.
Output for 7.1.0 - 7.2.6
Fatal error: Uncaught TypeError: Argument 2 passed to foo() must be an instance of integer or null, integer given, called in /in/hWRQc on line 9 and defined in /in/hWRQc:5 Stack trace: #0 /in/hWRQc(9): foo(NULL, 2) #1 {main} thrown in /in/hWRQc on line 5
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught TypeError: Argument 2 to foo() must be of type ?integer, int given in /in/hWRQc:-1 Stack trace: #0 /in/hWRQc(-1): foo() #1 {main}
Process exited with code 255.
Output for hhvm-3.21.3
Fatal error: Uncaught TypeError: Argument 2 to foo() must be of type ?integer, int given in /in/hWRQc:7 Stack trace: #0 /in/hWRQc(9): foo() #1 {main}
Process exited with code 255.
Output for hhvm-3.18.5
Fatal error: Uncaught Error: Syntax only allowed in Hack files (<?hh) or with -v Eval.EnableHipHopSyntax=true in /in/hWRQc:5 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /in/hWRQc on line 5
Process exited with code 255.