Difference between FUNCTION and METHOD
suggest change__FUNCTION__
returns only the name of the function whereas __METHOD__
returns the name of the class along with the name of the function:
<?php
class trick
{
public function doit()
{
echo __FUNCTION__;
}
public function doitagain()
{
echo __METHOD__;
}
}
$obj = new trick();
$obj->doit(); // Outputs: doit
$obj->doitagain(); // Outputs: trick::doitagain
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents