How can the use of PHP magic constants like __DIR__ improve code maintainability and readability?

Using PHP magic constants like __DIR__ can improve code maintainability and readability by providing a way to access the directory of the current file without hardcoding the path. This makes the code more flexible and easier to manage, especially when moving files around or working in different environments.

// Using __DIR__ to include a file
include __DIR__ . '/path/to/file.php';