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

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents