Skip to content

Instantly share code, notes, and snippets.

@yurifrl
Created January 15, 2014 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurifrl/8444264 to your computer and use it in GitHub Desktop.
Save yurifrl/8444264 to your computer and use it in GitHub Desktop.
Find Who called the Method
$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