How can the $_SERVER['DOCUMENT_ROOT'] superglobal variable be used to define paths in PHP?

The $_SERVER['DOCUMENT_ROOT'] superglobal variable in PHP can be used to define paths by providing the root directory of the server where the current script is executing. This is useful for creating absolute paths to files or directories within the server's file system, ensuring consistent and accurate file references regardless of the script's location.

// Define a path using $_SERVER['DOCUMENT_ROOT']
$filePath = $_SERVER['DOCUMENT_ROOT'] . "/path/to/file.php";

// Include a file using the defined path
include $filePath;