How does PHP determine the path for includes when working with nested directories?

When working with nested directories in PHP, the include path can be determined using the `__DIR__` magic constant to get the current directory of the script. By combining `__DIR__` with the relative path to the included file, PHP can accurately locate and include the file regardless of the directory structure.

// Example of including a file from a nested directory
include __DIR__ . '/path/to/file.php';