How can PHP developers ensure compatibility with different web hosting environments when using includes in their scripts?

When using includes in PHP scripts, developers can ensure compatibility with different web hosting environments by using the `$_SERVER['DOCUMENT_ROOT']` variable to specify the full path to the included file. This ensures that the script can locate the included file regardless of the server's configuration.

<?php
include $_SERVER['DOCUMENT_ROOT'] . '/path/to/included/file.php';
?>