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.14, 8.5.0
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.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 8.2.22 - 8.2.29, 8.3.5 - 8.3.28
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:
94.77 ms | 413 KiB | 5 Q