RE: [PHP] Caller's __LINE__
| From: | Neil Kimber | Date: | Wed, 28 Feb 2001 09:58:44 +0000 |
| Subject: | RE: [PHP] Caller's __LINE__ | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41976@lists.php.net to get a copy of this message | ||
Better still - use the set_error_handler() to define an error handler that
will output your debug statement and create your dbug message using
trigger_error(). Your registered error_handler will automatically receive
line number, file name and some other useful parameters.
-----Original Message-----
From: CC Zona [mailto:cczona@nospam.invalid]
Sent: 28 February 2001 09:37
To: php-general@lists.php.net
Subject: Re: [PHP] Caller's __LINE__
In article <97ifmk$p85$1@toye.p.sourceforge.net>,
elias_bachaalany@yahoo.com ("elias") wrote:
> function debuginfo($msg)
> {
> echo"<b>the message is $msg, at line" . __LINE__ . "
> </b><br>";
> }
>
> in my code:
> line 1
> line 2
> line x: debuginfo("hello!!!");
>
> is there is anyway to show the caller's line number? in this case 'x' ?
Pass __LINE__ to the function as one of its arguments:
function debuginfo($msg, __LINE__)
{
echo"<b>the message is $msg, at line" . __LINE__ . "
</b><br>";
}
--
CC
--
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