How can the $_SERVER['DOCUMENT_ROOT'] variable be used to handle file includes in PHP scripts?

The $_SERVER['DOCUMENT_ROOT'] variable can be used to handle file includes in PHP scripts by providing the absolute path to the root directory of the web server. This can be useful when including files from different directories within the project, ensuring that the correct file is always included regardless of the file's location.

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