3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test { public function metoda(?array $a) { var_dump($a); } } $a = new Test(); $a->metoda();
based on 1EnLj
Output for 7.1.0 - 7.3.0rc3
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Test::metoda(), 0 passed in /in/mugV7 on line 12 and exactly 1 expected in /in/mugV7:5 Stack trace: #0 /in/mugV7(12): Test->metoda() #1 {main} thrown in /in/mugV7 on line 5
Process exited with code 255.
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.0.20
Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /in/mugV7 on line 5
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Syntax only allowed in Hack files (<?hh) or with -v Eval.EnableHipHopSyntax=true in /in/mugV7:5 Stack trace: #0 {main}
Process exited with code 255.