How can one effectively set up and manage path constants in PHP to ensure consistent file inclusion across different contexts, such as main domains and subdomains?

When working with multiple domains and subdomains in PHP, it is important to set up path constants to ensure consistent file inclusion. One way to do this is by defining a base path constant in a configuration file and using it to construct the paths to include files. By using this approach, you can easily manage file inclusions across different contexts without worrying about the specific directory structure of each domain or subdomain.

```php
// config.php
define('BASE_PATH', '/var/www/html/');

// index.php
require_once BASE_PATH . 'includes/functions.php';
require_once BASE_PATH . 'subdomain/includes/sub_functions.php';
```

In this example, the `BASE_PATH` constant is defined in a configuration file, and it is used in `index.php` to include files from different directories within the main domain and subdomain. This ensures consistent file inclusion regardless of the context in which the PHP script is running.