1--TEST-- 2ReflectionClass::getMethods() 3--CREDITS-- 4Robin Fernandes <robinf@php.net> 5Steve Seear <stevseea@php.net> 6--FILE-- 7<?php 8class pubf { 9 public function f() {} 10 static public function s() {} 11} 12class subpubf extends pubf { 13} 14 15class protf { 16 protected function f() {} 17 static protected function s() {} 18} 19class subprotf extends protf { 20} 21 22class privf { 23 private function f() {} 24 static private function s() {} 25} 26class subprivf extends privf { 27} 28 29$classes = array("pubf", "subpubf", "protf", "subprotf", 30 "privf", "subprivf"); 31foreach($classes as $class) { 32 echo "Reflecting on class $class: \n"; 33 $rc = new ReflectionClass($class); 34 var_dump($rc->getMethods()); 35} 36 37?> 38--EXPECTF-- 39Reflecting on class pubf: 40array(2) { 41 [0]=> 42 &object(ReflectionMethod)#%d (2) { 43 [%u|b%"name"]=> 44 %unicode|string%(1) "f" 45 [%u|b%"class"]=> 46 %unicode|string%(4) "pubf" 47 } 48 [1]=> 49 &object(ReflectionMethod)#%d (2) { 50 [%u|b%"name"]=> 51 %unicode|string%(1) "s" 52 [%u|b%"class"]=> 53 %unicode|string%(4) "pubf" 54 } 55} 56Reflecting on class subpubf: 57array(2) { 58 [0]=> 59 &object(ReflectionMethod)#%d (2) { 60 [%u|b%"name"]=> 61 %unicode|string%(1) "f" 62 [%u|b%"class"]=> 63 %unicode|string%(4) "pubf" 64 } 65 [1]=> 66 &object(ReflectionMethod)#%d (2) { 67 [%u|b%"name"]=> 68 %unicode|string%(1) "s" 69 [%u|b%"class"]=> 70 %unicode|string%(4) "pubf" 71 } 72} 73Reflecting on class protf: 74array(2) { 75 [0]=> 76 &object(ReflectionMethod)#%d (2) { 77 [%u|b%"name"]=> 78 %unicode|string%(1) "f" 79 [%u|b%"class"]=> 80 %unicode|string%(5) "protf" 81 } 82 [1]=> 83 &object(ReflectionMethod)#%d (2) { 84 [%u|b%"name"]=> 85 %unicode|string%(1) "s" 86 [%u|b%"class"]=> 87 %unicode|string%(5) "protf" 88 } 89} 90Reflecting on class subprotf: 91array(2) { 92 [0]=> 93 &object(ReflectionMethod)#%d (2) { 94 [%u|b%"name"]=> 95 %unicode|string%(1) "f" 96 [%u|b%"class"]=> 97 %unicode|string%(5) "protf" 98 } 99 [1]=> 100 &object(ReflectionMethod)#%d (2) { 101 [%u|b%"name"]=> 102 %unicode|string%(1) "s" 103 [%u|b%"class"]=> 104 %unicode|string%(5) "protf" 105 } 106} 107Reflecting on class privf: 108array(2) { 109 [0]=> 110 &object(ReflectionMethod)#%d (2) { 111 [%u|b%"name"]=> 112 %unicode|string%(1) "f" 113 [%u|b%"class"]=> 114 %unicode|string%(5) "privf" 115 } 116 [1]=> 117 &object(ReflectionMethod)#%d (2) { 118 [%u|b%"name"]=> 119 %unicode|string%(1) "s" 120 [%u|b%"class"]=> 121 %unicode|string%(5) "privf" 122 } 123} 124Reflecting on class subprivf: 125array(2) { 126 [0]=> 127 &object(ReflectionMethod)#%d (2) { 128 [%u|b%"name"]=> 129 %unicode|string%(1) "f" 130 [%u|b%"class"]=> 131 %unicode|string%(5) "privf" 132 } 133 [1]=> 134 &object(ReflectionMethod)#%d (2) { 135 [%u|b%"name"]=> 136 %unicode|string%(1) "s" 137 [%u|b%"class"]=> 138 %unicode|string%(5) "privf" 139 } 140} 141