How can I get the name of the calling method in PHP

  • by
PHP Logo

I just fell in need of knowing the name of the method that is currently being called. After having a few minutes of unsuccessful searching i just thought of Late Static Binding and here the PHP Manual helped me.

Just do this inside your method;

echo __CLASS__; // For Class Name
echo __METHOD__; // For Method Name

Good Luck Developers.

Leave a Reply

Your email address will not be published. Required fields are marked *