Method 1 : (Prints function name):
__FUNCTION__ is used to resolve function name or method name (function in class).
Example 1:
<?php
class
Test {
public
function
bar() {
var_dump(
__FUNCTION__
);
}
}
function
foo() {
var_dump(
__FUNCTION__
);
}
// Must output string(3) 'foo'
foo();
$obj
=
new
Test;
// Must output string(3) 'bar'
$obj
->bar();
<?php
class
Test
{
public
function
foo() {
var_dump(
__METHOD__
);
}
}
function
bar()
{
var_dump(
__METHOD__
);
}
// Same As __FUNCTION__
bar();
$obj
=
new
Test;
// Output the fully qualified method name "ClassName::MethodName"
$obj
->foo();