1--TEST-- 2ReflectionObject::getConstant() basic function test 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 instance of class $class: \n"; 21 $rc = new ReflectionObject(new $class); 22 var_dump($rc->getConstant('a')); 23 var_dump($rc->getConstant('doesntexist')); 24} 25?> 26--EXPECT-- 27Reflecting on instance of class C: 28string(12) "hello from C" 29bool(false) 30Reflecting on instance of class D: 31string(12) "hello from C" 32bool(false) 33Reflecting on instance of class E: 34string(12) "hello from C" 35bool(false) 36Reflecting on instance of class F: 37string(12) "hello from F" 38bool(false) 39Reflecting on instance of class X: 40bool(false) 41bool(false) 42