Re: Function Call Line Number
| From: | dav | Date: | Wed, 14 Nov 2001 08:12:19 +0000 |
| Subject: | Re: Function Call Line Number | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-74550@lists.php.net to get a copy of this message | ||
Well, I don't know either but I was thinking about that...
Usually this "$lineno = __LINE__" would be avaluated when the function is
called, this mean it gives the __LINE__ of the function call itself.
Why don't you try a more simple "include"/require instead of calling a
funcion ?(see example)
but maybe it will return the value "LINE 1" in the included file... I don't
know...
that is:
...code...
include("line.php");
...code...
line.php
--------
echo(__LINE__);
"Jason G." <blair@nb.net> ha scritto nel messaggio
news:5.1.0.14.0.20011114015822.02d3ec88@pop3.nb.net...
> Hello,
>
> Does anyone know of a way, that from within a function, you can determine
> what line number and file the function was called on?
>
> I did try:
> function myfunc($lineno = __LINE__)
> {
> echo $lineno;
> }
> but this just outputted the very line that __LINE__ resides on.
>
> This would be very helpful in displaying sensible error messages, like the
> native php functions do.
>
> Thanks,
>
> -Jason Garber
> IonZoft.com
>