1--TEST-- 2ReflectionClass::getConstants() 3--FILE-- 4<?php 5class C { 6 const a = 'hello from C'; 7} 8class D extends C { 9} 10class E extends D { 11} 12class F extends E { 13 const a = 'hello from F'; 14} 15class X { 16} 17 18$classes = array("C", "D", "E", "F", "X"); 19foreach($classes as $class) { 20 echo "Reflecting on class $class: \n"; 21 $rc = new ReflectionClass($class); 22 var_dump($rc->getConstant('a')); 23 var_dump($rc->getConstant('doesntexist')); 24} 25?> 26--EXPECT-- 27Reflecting on class C: 28string(12) "hello from C" 29bool(false) 30Reflecting on class D: 31string(12) "hello from C" 32bool(false) 33Reflecting on class E: 34string(12) "hello from C" 35bool(false) 36Reflecting on class F: 37string(12) "hello from F" 38bool(false) 39Reflecting on class X: 40bool(false) 41bool(false) 42