1--TEST-- 2Test get_class_methods() function : basic functionality 3--FILE-- 4<?php 5/* Prototype : proto array get_class_methods(mixed class) 6 * Description: Returns an array of method names for class or class instance. 7 * Source code: Zend/zend_builtin_functions.c 8 * Alias to functions: 9 */ 10 11/* 12 * Test behaviour with interfaces. 13 */ 14 15interface I { 16 public function pubI(); 17 18} 19 20class C implements I { 21 public function pubI() {} 22 23 private function privC() {} 24 protected function protC() {} 25 public function pubC() {} 26 27 public static function testFromC() { 28 echo "Accessing I from C:\n"; 29 var_dump(get_class_methods("I")); 30 echo "Accessing C from C:\n"; 31 var_dump(get_class_methods("C")); 32 } 33} 34 35 36echo "Accessing I from global scope:\n"; 37var_dump(get_class_methods("I")); 38echo "Accessing C from global scope:\n"; 39var_dump(get_class_methods("C")); 40C::testFromC(); 41echo "Done"; 42?> 43--EXPECTF-- 44Accessing I from global scope: 45array(1) { 46 [0]=> 47 string(4) "pubI" 48} 49Accessing C from global scope: 50array(3) { 51 [0]=> 52 string(4) "pubI" 53 [1]=> 54 string(4) "pubC" 55 [2]=> 56 string(9) "testFromC" 57} 58Accessing I from C: 59array(1) { 60 [0]=> 61 string(4) "pubI" 62} 63Accessing C from C: 64array(5) { 65 [0]=> 66 string(4) "pubI" 67 [1]=> 68 string(5) "privC" 69 [2]=> 70 string(5) "protC" 71 [3]=> 72 string(4) "pubC" 73 [4]=> 74 string(9) "testFromC" 75} 76Done 77