PHP get_class_methods function usage
The get_class_methods function returns an array composed of class method names. This article will briefly share the usage of this function.
Function prototype array get_class_methods (mixed $ class_name)
Returns an array of method names defined in the class specified by class_name. If an error occurs, NULL is returned.
Note: from PHP 4.0.6, you can specify the object itself to replace class_name. The following is an example of get_class_methods:
<?phpclass myclass {// constructorfunction myclass() {return(true);}// method 1function myfunc1() {return(true);}// method 2function myfunc2() {return(true);}}$class_methods = get_class_methods('myclass');// or$class_methods = get_class_methods(new myclass());foreach ($class_methods as $method_name) {echo $method_name,'<br />';}
The above example will output:
Myclass
Myfunc1
Myfunc2
Note:
Since PHP 5, this function is returned (case sensitive) according to the name defined by the method ). PHP 4 always returns lowercase letters.
Articles you may be interested in
- Php uses the session_set_save_handler () function to save the session to the MySQL database.
- Functions and usage of the php get_headers Function
- Simulate the get_headers function in php.
- Comparison of file_get_contents with curl in PHP
- PhpMyAdmin Cannot start session without errors error Solution
- Php get_headers determines whether the URL is valid
- Obtain the function of the sub-class_id set
- Php mktime Function Analysis