3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(bar $a = null, $b) { } $r = new ReflectionParameter('foo', 0); try { $r->getClass(); } catch (\Exception $e) { echo $e->getMessage(); } var_dump($r->getDefaultValue());
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: Method ReflectionParameter::getClass() is deprecated in /in/L8mhS on line 10 Class "bar" does not exist Fatal error: Uncaught ReflectionException: Internal error: Failed to retrieve the default value in /in/L8mhS:15 Stack trace: #0 /in/L8mhS(15): ReflectionParameter->getDefaultValue() #1 {main} thrown in /in/L8mhS on line 15
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Deprecated: Method ReflectionParameter::getClass() is deprecated in /in/L8mhS on line 10 Class "bar" does not existNULL
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Class bar does not existNULL

preferences:
166.89 ms | 403 KiB | 213 Q