Home > Backend Development > PHP Tutorial > Get the current class name, method name, function name magic constant in PHP (first time using markdown) markdown2 markdownextended zara's markdown

Get the current class name, method name, function name magic constant in PHP (first time using markdown) markdown2 markdownextended zara's markdown

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-29 08:53:01
Original
1425 people have browsed it

For an introduction to commonly used magic constants, you can directly refer to the PHP manual: Connection
Attached is a demo:

<code><span><?php</span><span>/**
 * Created by PhpStorm.
 * User: yanfeng
 * Date: 2016/3/31
 * Time: 13:28
 */</span><span><span>function</span><span>output</span><span>()</span>
{</span><span>echo</span><span>"function:<br>"</span>;
    <span>echo</span><span>__CLASS__</span> . <span>"<br>"</span>;
    <span>echo</span><span>__METHOD__</span> . <span>"<br>"</span>;
    <span>echo</span><span>__FUNCTION__</span> . <span>"<br>"</span>;
}

<span><span>class</span><span>test</span>
{</span><span>static</span><span><span>function</span><span>output</span><span>()</span>
    {</span><span>echo</span><span>"class:<br>"</span>;
        <span>echo</span><span>__CLASS__</span> . <span>"<br>"</span>;
        <span>echo</span><span>__METHOD__</span> . <span>"<br>"</span>;
        <span>echo</span><span>__FUNCTION__</span> . <span>"<br>"</span>;
        output();
    }
}

test::output();</code>
Copy after login

Output result:

<code>class:
test
test::output
output
function:

output
output</code>
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces how to get the current class name, method name, and function name magic constant in PHP (first time using markdown), including markdown content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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