Getting __LINE__ of calling function

From: Date: Tue, 25 Mar 2003 00:36:48 +0000
Subject: Getting __LINE__ of calling function
Groups: php.general 
Request: Send a blank email to php-general+get-140909@lists.php.net to get a copy of this message
I have a class that does database transactions. If there is an SQL error in the query, the error line is always from the class. It should be from the caller/creator of the class so the programmer will know exactly what code caused the error. I could have the code that calls the database class pass in __LINE__ and __FILE__. But this is a hassle, is there a way , from inside a function/method to retrieve the __LINE__ and __FILE__ of the CALLING function? I.e., is there a way to look at the stack and see the valueof variables in it?

« previous php.general (#140909) next »