What are the potential pitfalls of using $GLOBALS in PHP for storing project-wide values?

Using $GLOBALS in PHP for storing project-wide values can lead to global state pollution, making it difficult to track where and when values are being modified. It can also make code less modular and harder to maintain. To solve this issue, consider using a configuration file or a dependency injection container to manage project-wide values in a more organized and structured way.

// config.php
return [
    'project_name' => 'My Project',
    'api_key' => '123456789',
    // other project-wide values
];
```

```php
// index.php
$config = include 'config.php';

echo $config['project_name']; // Output: My Project
echo $config['api_key']; // Output: 123456789