Should one always use "__DIR__" before relative file paths in PHP for better control and consistency?

When working with file paths in PHP, using "__DIR__" before relative paths can provide better control and consistency. This ensures that the path is always relative to the current file, regardless of where the script is executed from. It helps avoid issues with file inclusion or manipulation due to changes in the script's working directory.

// Using __DIR__ before relative file paths for better control and consistency
include __DIR__ . '/path/to/file.php';

// Example of reading a file using __DIR__
$fileContents = file_get_contents(__DIR__ . '/path/to/file.txt');