What are the potential pitfalls of using arrays for configuration in PHP?

Using arrays for configuration in PHP can lead to potential pitfalls such as difficulty in managing and updating configuration values, lack of type safety, and potential for errors due to typos in array keys. To solve this issue, consider using a dedicated configuration file or a configuration class with constants or methods to access configuration values.

// Configuration class with constants
class Config {
    const DB_HOST = 'localhost';
    const DB_USER = 'root';
    const DB_PASS = 'password';
}

// Accessing configuration values
$dbHost = Config::DB_HOST;
$dbUser = Config::DB_USER;
$dbPass = Config::DB_PASS;