What is the purpose of using __DIR__ in PHP?

__DIR__ in PHP is a magic constant that represents the directory of the current PHP script. It is useful for including files relative to the current script's location, ensuring that the file paths are always correct regardless of where the script is executed from.

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