...

View Full Version : Can I get info of which file and line number made a call to my own function?



needsomehelp
11-17-2012, 04:15 PM
Is it possible to get the file and line number where a call was made to a function?

tangoforce
11-17-2012, 07:39 PM
Hello,

Yes for the current line and file you can use the magic constants __LINE__ and __FILE__.

For the call stack, you can use debug_backtrace() (http://uk3.php.net/debug_backtrace) though you'll want to run that through var_dump(). It will give you an array of arrays with things like function names, line numbers etc.

needsomehelp
11-17-2012, 07:45 PM
ah, thank you for this, I shall look in to it more and see if this can help me.

Cheers



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum