Which of the following statements is true about __FILE__ constant?
It contains the name of the file and full path.
Correct:
It contains the name of the file and full path.
Explanation:
Answer options D is correct.
__FILE is a magic constant that contains the full path and filename of the file. If \FILE__ is used inside an include, the name of the included file is returned.
Answer option C is incorrect. __DIR contains name of the directory having file and full path of the directory. It is equivalent to dirname(\FILE__).
Answer options B and A are incorrect. The __LINE__ constant is used to retrieve the current line number of the file. The $_SERVER['SCRIPT_FILENAME'] global variable is used to retrieve the current relative path of a script.