Created
January 15, 2014 20:45
-
-
Save yurifrl/8444264 to your computer and use it in GitHub Desktop.
Find Who called the Method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$trace = debug_backtrace(); | |
if (isset($trace[1])) { | |
// $trace[0] is ourself | |
// $trace[1] is our caller | |
// and so on... | |
var_dump($trace[1]); | |
echo "called by {$trace[1]['class']} :: {$trace[1]['function']}"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment