php - Getting the filename of where a function was called from -
is possible (in efficient manor) retrieve filename (and line if possible) of previous command called function in (included) file?
for example:
foo.php
function foo() { bar(); }
bar.php
function bar() { // stuff show when above executed: // foo.php, line 2 (last bit if possible) }
thats job debug_backtrace()
:
function test($param) { echo "$param"; var_dump(debug_backtrace()); }
Comments
Post a Comment