PHP's __METHOD__ magic constant usage_PHP tutorial

WBOY
Release: 2016-07-13 17:14:47
Original
1228 people have browsed it

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();

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!