What are some best practices for maintaining the functionality of PHP scripts when dealing with different directory structures?

When dealing with different directory structures, it's important to use relative paths instead of absolute paths in your PHP scripts. This ensures that the script will work regardless of where it is located within the directory structure. Additionally, using the `__DIR__` magic constant can help in creating paths relative to the current file's directory.

// Example of using relative paths with the __DIR__ magic constant
include __DIR__ . '/includes/config.php';