note 30522 deleted from reserved by philip
| From: | philip@php.net | Date: | Wed, 07 May 2003 22:44:19 +0000 |
| Subject: | note 30522 deleted from reserved by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-47658@lists.php.net to get a copy of this message | ||
I don't see anywhere else in the manual where this is documented, so: the __FILE__ keyword is
the filename of the current file, and __LINE__ is the line in the file. Note that this is not the
same as using some of the variables, such as $GLOBALS['PHP_SELF'], because for example:
bar.php:
<?php
echo "\n";
echo __FILE__;
echo "\n";
echo __LINE__;
?>
foo.php:
<?php
include("bar.php");
echo "\n";
echo __FILE__;
echo "\n";
echo __LINE__;
?>
executing foo.php gives me this:
/var/www/html/bar.php
5
/var/www/html/foo.php
6
Whereas if I used for example $GLOBALS['SCRIPT_FILENAME'] I would see the same filename
for both outputs... suppose I change bar.php to be
<?php
echo "\n";
echo __FILE__;
echo $GLOBALS['SCRIPT_FILENAME'];
?>
Then executing foo.php will say
/var/www/html/bar.php // <-- this line came from bar.php
/var/www/html/foo.php // <-- this line came from bar.php
/var/www/html/foo.php // <-- this line came from foo.php
6