3v4l.org

run code in 200+ PHP versions simultaneously
<?php class Test { function method($a = self::UNDEFINED) { } } $rp = new ReflectionParameter(['Test', 'method'], 'a'); try { $val = $rp->getDefaultValue(); } catch (Error $ex) { var_dump($ex); }
based on X8gXu
Output for 7.0.28 - 7.3.1
object(Error)#2 (7) { ["message":protected]=> string(42) "Undefined class constant 'self::UNDEFINED'" ["string":"Error":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/hAdkZ" ["line":protected]=> int(12) ["trace":"Error":private]=> array(1) { [0]=> array(6) { ["file"]=> string(9) "/in/hAdkZ" ["line"]=> int(12) ["function"]=> string(15) "getDefaultValue" ["class"]=> string(19) "ReflectionParameter" ["type"]=> string(2) "->" ["args"]=> array(0) { } } } ["previous":"Error":private]=> NULL }
Output for 5.6.30
Fatal error: Undefined class constant 'self::UNDEFINED' in /in/hAdkZ on line 12
Process exited with code 255.