Re: Which file called the function?

From: Date: Thu, 20 Dec 2007 14:51:22 +0000
Subject: Re: Which file called the function?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-266155@lists.php.net to get a copy of this message
Christoph Boget schreef: >> I believe __FILE__ is resolved at compile time, not run-time which >> means what you're seeing is expected behavior. I'm not sure how you'd >> get the name of the file that a function call was made from. >> Could you explain why you need this information in your application, >> and perhaps someone might offer an alternative solution? > > I'm not saying it's not expected behavior. In fact, that exactly what I > would expect based on what the docs say. I'm just asking if there is > another way to get the script file name that's calling the function. > > I need it primarily for debugging purposes. I've got a single function > that's called by several files. And instead of modifying all the files > calling the function to add logging, it would be nice to just modify the > function, adding logging only to it to also include what script called it. > > > I know I can get the information from debug_backtrace but I figured there > might be a better/easier way. nope, debug_backtrace() is the way to go. > > thnx, > Christoph > > > ____________________________________________________________________________________ > Looking for last minute shopping deals? > Find them fast with Yahoo! Search. > http://tools.search.yahoo.com/newsearch/category.php?category=shopping >

« previous php.general (#266155) next »