3v4l.org

run code in 300+ PHP versions simultaneously
<?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.

preferences:
163.28 ms | 1395 KiB | 36 Q