Re: Caller's Line number?
| From: | Yasuo Ohgaki | Date: | Wed, 28 Mar 2001 11:07:10 +0000 |
| Subject: | Re: Caller's Line number? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45877@lists.php.net to get a copy of this message | ||
Not sure what you really mean.
__LINE__ contains current line number in the script wherever it is used. So if
you want caller's line number
function foo($line) {
echo 'Line number: '. $line;
}
foo(__LINE__);
You can get the caller's line number. (Line number of foo(__LINE__);)
Regards,
--
Yasuo Ohgaki
""elias"" <elias_bachaalany@yahoo.com> wrote in message
news:99s17u$fd7$1@toye.p.sourceforge.net...
> Hello,
>
> can i make a function that displays the __LINE__ of it's caller?
>
> ie:
>
> function show_caller_s_line()
> {
> echo "my caller's line is:" . __LINE__;
> }
>
> 1: blahblahblah
> 2: show_caller_s_line()
> 3: blahblah
>
> output should be:
> my caller's line is: 3
>
>
> is that possible?
>
> thanks.
> -elias
>
>
>
> --
> 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
>