Home  >  Article  >  Backend Development  >  PHP function method to obtain and check class name, function name, method name_PHP tutorial

PHP function method to obtain and check class name, function name, method name_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:48:52873browse

PHP’s function methods to obtain and check class names, function names, and method names

This article mainly introduces the functions of PHP to obtain and check class names, function names, and method names. Method, this article summarizes the functions and usage of 7 functions. Friends in need can refer to it

 1.function_exists() - Return TRUE if the given function has been defined

 2.is_callable() - Check whether the parameter is a legal callable structure

 3.class_exists() - Check whether the class has been defined

 4.method_exists() - Check whether the class method exists

 __FUNCTION__ function name (newly added in PHP 4.3.0). Since PHP 5 this constant returns the name of the function when it was defined (case sensitive). In PHP 4 this value is always lowercase.

__CLASS__ The name of the class (newly added in PHP 4.3.0). Since PHP 5 this constant returns the name of the class when it was defined (case sensitive). In PHP 4 this value is always lowercase.

 __METHOD__ The method name of the class (newly added in PHP 5.0.0). Returns the name of the method as it was defined (case-sensitive).

Note: These constants are preceded and followed by two underscores.

 get_class(class name);//Get the class name of the class where the current statement is located

 get_class_methods(class name);//Get all the method names of class name and form an array

 get_class_vars(class name);//Get all the highlighted names of class name and form an array

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1021560.htmlTechArticlephp function method to obtain, check class name, function name, method name. This article mainly introduces php acquisition, Check the function methods of class names, function names, and method names. This article summarizes 7 functions...
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