3v4l.org

run code in 300+ PHP versions simultaneously
<?php $reflectionMethod = new ReflectionMethod(Exception::class, "__construct"); foreach ($reflectionMethod->getParameters() as $reflectionParameter) { $defaultValue = null; if (!$reflectionParameter->isDefaultValueAvailable()) { print $reflectionParameter->isDefaultValueConstant() ? "constant" : "no constant"; } else { print "not available"; } print PHP_EOL; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
not available not available not available
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught ReflectionException: Cannot determine default value for internal functions in /in/m21O0:9 Stack trace: #0 /in/m21O0(9): ReflectionParameter->isDefaultValueConstant() #1 {main} thrown in /in/m21O0 on line 9
Process exited with code 255.
Output for 5.6.0 - 5.6.25
Fatal error: Uncaught exception 'ReflectionException' with message 'Cannot determine default value for internal functions' in /in/m21O0:9 Stack trace: #0 /in/m21O0(9): ReflectionParameter->isDefaultValueConstant() #1 {main} thrown in /in/m21O0 on line 9
Process exited with code 255.

preferences:
86.03 ms | 1522 KiB | 4 Q