+3  A: 

You'll have to use debug_backtrace for this or else always pass the line (with __LINE__) to the function.

Artefacto
+1 Note that `debug_backtrace` is slooow, so it should really be used only in debugging mode.
Pekka
+1  A: 

Have you seen debug_backtrace()? I'm not sure of its overhead though.

JosePaulo