English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Class/Object function reference manual
The get_class_methods() function returns an array composed of class method names
get_class_methods($class_name);
It retrieves the class method names. Returns an array of method names defined by class_name. If an error occurs, it returns NULL.
Number | Parameters and Description |
---|---|
1 | class_name(Required) Class name. |
Returns an array of method names defined in the class specified by class_name. If an error occurs, it returns NULL.
The following is the usage of this function, to get the method names of HelloWorld class-
<?php class HelloWorld { function HelloWorld() { return(true); } function myfunc1() { return(true); } function myfunc2() { return(true); } } $method = get_class_methods('HelloWorld'); $method = get_class_methods(new HelloWorld()); foreach ($method as $method_name) { echo "$method_name \n"; } ?>Test to see ‹/›
It will produce the following result-
HelloWorld myfunc1 myfunc2