PHP: Dynamically Discovering Current Function’s Name

If you are writing a script that bases decisions on a method name or function, how can you pick this information up?

Using Magic Constants - that’s how!

See PHP Manual: http://uk.php.net/manual/en/language.constants.predefined.php

Also, in PHP5 the built-in Reflection API classes might well be useful.

Leave a Reply