3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A{ function B($x , $y=null , $z=null) { } } $m = new ReflectionMethod('a','b'); $p = $m->getParameters(); var_dump($p[0]->getDefaultValue());
based on hQ12j
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught ReflectionException: Internal error: Failed to retrieve the default value in /in/Ops3U:12 Stack trace: #0 /in/Ops3U(12): ReflectionParameter->getDefaultValue() #1 {main} thrown in /in/Ops3U on line 12
Process exited with code 255.
Output for 5.4.7 - 5.6.28
Fatal error: Uncaught exception 'ReflectionException' with message 'Internal error: Failed to retrieve the default value' in /in/Ops3U:12 Stack trace: #0 /in/Ops3U(12): ReflectionParameter->getDefaultValue() #1 {main} thrown in /in/Ops3U on line 12
Process exited with code 255.
Output for 5.4.2 - 5.4.6
Fatal error: Uncaught exception 'ReflectionException' with message 'Parameter is not optional' in /in/Ops3U:12 Stack trace: #0 /in/Ops3U(12): ReflectionParameter->getDefaultValue() #1 {main} thrown in /in/Ops3U on line 12
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Fatal error: Uncaught exception 'ReflectionException' with message 'Internal error' in /in/Ops3U:12 Stack trace: #0 /in/Ops3U(12): ReflectionParameter->getDefaultValue() #1 {main} thrown in /in/Ops3U on line 12
Process exited with code 255.