3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php if(PHP_MAJOR_VERSION < 7 or PHP_MINOR_VERSION < 1) die(); declare(strict_types=1); function testParam(?string $arg){ var_dump($arg); } testParam(null); testParam("hi"); testParam();
Output for 7.1.0 - 7.1.7
Fatal error: strict_types declaration must be the very first statement in the script in /in/rarhm on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /in/rarhm on line 7
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: strict_types declaration must be the very first statement in the script: (Line: 5, Char: 23) in /in/rarhm:5 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Warning: Unsupported declare 'strict_types' in /in/rarhm on line 5 Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /in/rarhm on line 7
Process exited with code 255.