Posted by Anze on 09/21/05 12:39
Hi all!
Is it possible (in PHP4 and PHP5) to get the filename and line number of the
call to the current function? I need it for debugging purposes:
function query_DB($sql) {
... // do a query here
if ($query_failed)
write_to_log($fail_reason."; Called from ".$__CALLING_FILE__.
" line: ".__CALLING_LINE__);
... // return result
}
__FILE__ and __LINE__ are not good enough - they will always return the
address of query_DB() function, but I need the address where the function
was called (this is where the error comes from).
Any idea if this can be done?
Kind regards,
Anze
Navigation:
[Reply to this message]
|