Home > Backend Development > PHP Tutorial > PHP gets the current class name, function name, method name

PHP gets the current class name, function name, method name

WBOY
Release: 2016-08-08 09:21:17
Original
2925 people have browsed it

      • PHP gets the current class name function name method name
        • PHP gets the current class name method name
        • function defined

PHP gets the current class name, function Name, method name

PHP gets the current class name, method name

  • __CLASS__ Gets the current class name
  • __FUNCTION__ Current function name (confirm)
  • __METHOD__ Current method name (bankcard::confirm)

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

__CLASS__ The name of the class (new 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).

defined function

  • 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 the class name class and form an array
  • get_class_vars(class name);//Get all the highlighted names of class name and form an array

Copyright statement: This article is an original article by the blogger and may not be reproduced without the permission of the blogger.

The above introduces how PHP obtains the current class name, function name, and method name, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template