Home >Backend Development >PHP Tutorial >PHP's __METHOD__ magic constant usage_PHP tutorial

PHP's __METHOD__ magic constant usage_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:14:471254browse

This article briefly introduces the usage of METHOD, which is a magic constant that will only be available after php5. Friends in need can refer to it.

__METHOD__ is a new magic constant after PHP5, which represents the name of the class grammar

echo __METHOD__; }
The code is as follows
 代码如下 复制代码

class chhua{
function test(){
echo __METHOD__;
}
}

$e=new chhua();

$e->test();//输出:chhua::test

Copy code


class chhua{

function test(){
}

$e=new chhua();

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