3v4l.org

run code in 500+ 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.18, 8.5.0 - 8.5.3
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.30, 8.3.5 - 8.3.30
bool(true)
Output for 8.1.30 - 8.1.34
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:
62.3 ms | 978 KiB | 4 Q