run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function testParam(string $arg = null){ var_dump($arg); } testParam(null); testParam("hi"); testParam();
based on OlWg5
Output for hhvm-3.15.4, 7.0.0 - 7.2.6
NULL string(2) "hi" NULL
Output for 5.6.0 - 5.6.30
Warning: Unsupported declare 'strict_types' in /in/Lf5Cu on line 3 NULL Catchable fatal error: Argument 1 passed to testParam() must be an instance of string, string given, called in /in/Lf5Cu on line 10 and defined in /in/Lf5Cu on line 5
Process exited with code 255.