Difference between __FUNCTION__ and __METHOD__

The difference between __FUNCTION__ and __METHOD__ as in PHP 5.0.4 is that

__FUNCTION__ returns only the name of the function

while as __METHOD__ returns the name of the class alongwith the name of the function

class trick
      function doit()
                echo __FUNCTION__;
      function doitagain()
                echo __METHOD__;

$obj=new trick();
output will be —-  doit
output will be —– trick::doitagain

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>