How can absolute paths be used to avoid issues with including files in PHP?

When including files in PHP, using absolute paths instead of relative paths can help avoid issues with file inclusion. Absolute paths specify the full path to the file on the server, ensuring that the correct file is included regardless of the current working directory. This can prevent errors that may occur when including files from different directories.

// Using absolute path to include a file
include_once('/var/www/html/includes/config.php');