__FILE__¶
__FILE__ holds the current file name.
The file name includes it absolute path, e.g. /tmp/path/to/file.txt. It also uses the file actual case.
When used without a file, aka in command line, __FILE__ contains Command line code.
__FILE__ is often used with __LINE__, which holds the line number.
This constant is written in uppercase, by convention. It is case insensitive, and may be used with any combination of uppercase and lower case.
<?php
function foo() {
echo __FILE__; // /tmp/test.php
}
foo();
?>
Related : Magic Constants, __LINE__, __METHOD__, Special Constant