What are the advantages and disadvantages of using global constants in PHP, specifically for defining root paths?

Using global constants in PHP to define root paths can make it easier to manage file paths throughout your application by providing a central location to update paths if needed. This can help prevent errors caused by incorrect file paths. However, using global constants can also make your code less flexible if the root path needs to be changed frequently or if different environments require different root paths.

<?php
define('ROOT_PATH', '/var/www/html/');
// Use ROOT_PATH in your code to reference the root directory
?>