Sometimes you don’t have a debugger handy, but you have a function acting weird and you want to know where it’s being called. You can find out using the backtrace, like this –
And send that to /tmp/php-errors by using error_log.
error_log( "called by: " . debug_backtrace()['function'] );