View Full Version : Can I get info of which file and line number made a call to my own function?
11-17-2012, 05:15 PM
Is it possible to get the file and line number where a call was made to a function?
11-17-2012, 08:39 PM
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.
11-17-2012, 08:45 PM
ah, thank you for this, I shall look in to it more and see if this can help me.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.