What are some alternative methods to determine the base directory in PHP for including files with varying directory depths?

When including files in PHP that reside in directories of varying depths, it can be challenging to determine the base directory dynamically. One alternative method is to use the `__DIR__` magic constant, which returns the directory of the file it is used in. By using `__DIR__`, we can construct the base directory path for including files regardless of the directory depth.

// Determine the base directory dynamically using __DIR__
$baseDir = __DIR__;

// Include a file using the base directory path
include $baseDir . '/path/to/file.php';