How can relative paths be handled effectively in PHP when including files from different directories?
Relative paths in PHP can be handled effectively by using the `__DIR__` magic constant to reference the current directory of the file being executed. This allows for including files using relative paths regardless of the current working directory. By combining `__DIR__` with the `../` notation to navigate up directories if needed, you can ensure that your file includes work consistently across different directories.
<?php
// Include a file using a relative path from the current directory
include __DIR__ . '/path/to/file.php';