Jason G. wrote:

> Does anyone know of a way, that from within a function, you can determine
> what line number and file the function was called on?

Cannot be done with existing built-in PHP functions...

Feel free to add that feature to the PHP source and contribute it :-)

> 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.

If you use http://php.net/set_error_handler properly, you can get what you 
want, though.  That lets you register a function to be called in the event 
of an error, and it has optional arguments you can provide to get the 
__FILE__ and __LINE__ values.

-- 
Like music?  http://l-i-e.com/artists.htm


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to