3v4l.org

run code in 300+ PHP versions simultaneously
<?php $f = function (X&Y $foo = null) {}; $r = new ReflectionParameter($f, 0); var_dump($r->getType()->allowsNull());
Output for 8.4.1 - 8.4.12
Deprecated: {closure:/in/aURFN:3}(): Implicitly marking parameter $foo as nullable is deprecated, the explicit nullable type must be used instead in /in/aURFN on line 3 bool(true)
Output for 8.2.22 - 8.2.29, 8.3.5 - 8.3.25
bool(true)
Output for 8.1.30 - 8.1.33
Fatal error: Cannot use null as default value for parameter $foo of type X&Y in /in/aURFN on line 3
Process exited with code 255.
Output for 8.0.0 - 8.0.9
Parse error: syntax error, unexpected identifier "Y", expecting variable in /in/aURFN on line 3
Process exited with code 255.
Output for 7.3.0 - 7.3.29, 7.4.0 - 7.4.21
Parse error: syntax error, unexpected 'Y' (T_STRING), expecting variable (T_VARIABLE) in /in/aURFN on line 3
Process exited with code 255.

preferences:
40.52 ms | 411 KiB | 5 Q