What does __FILE__ mean?

  1. The realpath() function gives you the file-system path, with any symbolic links and directory traversing (e.g. ../../) resolved. The dirname() function gives you just the directory, not the file within it.
  2. __FILE__ is a magic constant that gives you the filesystem path to the current .php file (the one that __FILE__ is in, not the one it’s included by if it’s an include.
  3. Sounds about right.
  4. This is to translate from Windows style (\) paths to Unix style (/).

Leave a Comment