Home  >  Article  >  Backend Development  >  How to get all methods of a class in php

How to get all methods of a class in php

王林
王林Original
2020-08-27 13:55:322124browse

php can use the get_class_methods() function to obtain all methods of a class. This function can return an array consisting of the method names of the class, or NULL if an error occurs. Function syntax: [get_class_methods($class_name)].

How to get all methods of a class in php

php provides us with a function get_class_methods, which can return an array composed of class method names, and returns NULL if an error occurs.

(Recommended video tutorial: php video tutorial)

Grammar:

array get_class_methods ( mixed $class_name )

(Related recommendation: php training)

Code example:

Output:

myclass
myfunc1
myfunc2

The above is the detailed content of How to get all methods of a class in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn