1--TEST-- 2ReflectionObject::getConstants() - 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->getConstants()); 23} 24 25?> 26--EXPECTF-- 27Reflecting on instance of class C: 28array(1) { 29 ["a"]=> 30 string(12) "hello from C" 31} 32Reflecting on instance of class D: 33array(1) { 34 ["a"]=> 35 string(12) "hello from C" 36} 37Reflecting on instance of class E: 38array(1) { 39 ["a"]=> 40 string(12) "hello from C" 41} 42Reflecting on instance of class F: 43array(1) { 44 ["a"]=> 45 string(12) "hello from F" 46} 47Reflecting on instance of class X: 48array(0) { 49} 50