Re: Function Call Line Number
| From: | dav | Date: | Wed, 14 Nov 2001 08:14:51 +0000 |
| Subject: | Re: Function Call Line Number | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-74551@lists.php.net to get a copy of this message | ||
Another thing...
if the $lineno variable isn't defined yet, maybe the parser first try a cast
into __LINE__ type, so even if the assign procedure is called at the
function call, the line is evaluated at the funcion definition step...
but maybe it's a bullship :-)
J
"Dav" <dav@thecloud.o> ha scritto nel messaggio
news:20011114080844.88383.qmail@pb1.pair.com...
> 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
> >
>
>