faqts : Computers : Programming : Languages : PHP : kms

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

150 of 158 people (95%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

When there is an error in PHP, the parser outputs the line number. Is there some function or variable that will output the current line number?

Aug 30th, 2000 18:57
Chris Kings-Lynne, Craig Fratrik, Ben Udall, PHP Manual Chapter 8: Constants


PHP defines several constants and provides a mechanism for defining 
more at run-time. Constants are much like variables, save for the two 
facts that constants must be defined using the define() function, and 
that they cannot later be redefined to another value.
Some predefined constants (always available) are: 
__FILE__
The name of the script file presently being parsed. If used within a 
file which has been included or required, then the name of the included 
file is given, and not the name of the parent file. 
__LINE__
The number of the line within the current script file which is being 
parsed. If used within a file which has been included or required, then 
the position within the included file is given. 
eg. report_error(__FILE__,__LINE__, "Something went wrong!");