Re: error handling and __LINE__

From: Date: Fri, 23 Nov 2001 00:32:40 +0000
Subject: Re: error handling and __LINE__
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-75550@lists.php.net to get a copy of this message
try, assert() instead of echo()ing error messages. assert('is_object($obj)'); and write your error handler code or use mine :) or am i missing something? Papp Gyozo - pgerzson@freestart.hu ----- Original Message ----- From: "SafeV" <nedenom@hotmail.com> To: <php-general@lists.php.net> Sent: Thursday, November 22, 2001 4:15 PM Subject: [PHP] error handling and __LINE__ | Hi, | I wonder if there's a way to find the line number of the calling script | from a function, like the error messages PHP generates. An example: | | In an included file I have a function and want to do something similar to: | | function foo($obj) { | if (!is_object($obj)) { | echo "Error: supplied argument is not an object in "; | echo __FILE__ . " line " . __LINE__; | } | ... | } | | But __FILE__ and __LINE__ refers to the current file, ie. the file with | the function in, and not the file where the function is called from. | The first one I can solve by using $SCRIPT_NAME, but what about the line | number??? | | | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net | For additional commands, e-mail: php-general-help@lists.php.net | To contact the list administrators, e-mail: php-list-admin@lists.php.net |

« previous php.general (#75550) next »