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 basic behaviour with existing class and non-existent class. 13 */ 14 15echo "*** Testing get_class_methods() : basic functionality ***\n"; 16 17class C { 18 function f() {} 19 function g() {} 20 function h() {} 21} 22 23echo "Argument is class name:\n"; 24var_dump( get_class_methods("C") ); 25echo "Argument is class instance:\n"; 26$c = new C; 27var_dump( get_class_methods($c) ); 28 29class D {} 30echo "Argument is name of class which has no methods:\n"; 31var_dump( get_class_methods("D") ); 32 33echo "Argument is non existent class:\n"; 34var_dump( get_class_methods("NonExistent") ); 35 36echo "Done"; 37?> 38--EXPECTF-- 39*** Testing get_class_methods() : basic functionality *** 40Argument is class name: 41array(3) { 42 [0]=> 43 string(1) "f" 44 [1]=> 45 string(1) "g" 46 [2]=> 47 string(1) "h" 48} 49Argument is class instance: 50array(3) { 51 [0]=> 52 string(1) "f" 53 [1]=> 54 string(1) "g" 55 [2]=> 56 string(1) "h" 57} 58Argument is name of class which has no methods: 59array(0) { 60} 61Argument is non existent class: 62NULL 63Done