Re: How to get script name and line number
| From: | Brian McGarvie | Date: | Fri, 29 Aug 2003 10:06:56 +0000 |
| Subject: | Re: How to get script name and line number | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-21276@lists.php.net to get a copy of this message | ||
"William Cheung" <william@databyte.com> wrote in message
news:002701c36db3$5fe802c0$3d6ea8c0@databyte.com...
>>I need to error log the script name and the line number that an error
occurs. Are there built-in variables I could make use of?
There are 2 ways to get file name:
1) Using the 'magic constatns': $thefile = __FILE__;
2) Using $_SERVER superarray: $thefile = $_SERVER['SCRIPT_NAME'];
Note:1) will return the FULL path, 2) will return the relative path.
There is only one way to get line number that i know of:
$theline = __LINE__;
But it will quite literally be the line that __LINE__ is used.