How can the use of __DIR__ improve the security and reliability of file path references in PHP?

When using hardcoded file paths in PHP, there is a risk of errors due to changes in directory structure or environment. By using the `__DIR__` magic constant, you can create file path references that are relative to the current file, making your code more portable, secure, and reliable.

// Incorrect way using hardcoded file path
include '/path/to/file.php';

// Correct way using __DIR__ for relative file path
include __DIR__ . '/file.php';