I know the __FILE__ magic constant in PHP will turn into the full path and filename of the currently executing file. But is there a way I can get the same information for a function's calling file? For example:
//foo.php:
include "bar.php";
call_it();
//bar.php
function call_it() {
echo "Calling file: ".__CALLING_FILE__;
}
which would output Calling file: ....../foo.php.
I know there's no __CALLING_FILE__ magic constant, or a magic constant to handle this, but is there a way I can get that information? The least-hackish solution would be ideal (eg. using a stack trace would be pretty hacky) but in the end I just need it to work.