What are the potential issues with using relative paths in PHP includes for variable passing between different files?

When using relative paths in PHP includes for variable passing between different files, the issue arises when the included file is included in a different directory context. To solve this, it is recommended to use absolute paths or define a base path constant in your main file and use it to construct the paths to included files.

<?php
// Define a base path constant
define('BASE_PATH', dirname(__FILE__) . '/');

// Include the file using the base path constant
include(BASE_PATH . 'included_file.php');
?>