How can PHP beginners effectively organize and manage configuration variables in their scripts?

PHP beginners can effectively organize and manage configuration variables in their scripts by creating a separate configuration file where all variables are stored. This file can then be included in their main script whenever these variables are needed. By centralizing configuration variables in one file, it makes it easier to update and maintain them without having to search through the entire codebase.

// config.php
<?php

$config = [
    'db_host' => 'localhost',
    'db_user' => 'root',
    'db_pass' => 'password',
    'db_name' => 'database_name'
];
```

```php
// main_script.php
<?php

include 'config.php';

// Now you can access configuration variables like this
echo $config['db_host']; // Outputs: localhost
echo $config['db_user']; // Outputs: root
echo $config['db_pass']; // Outputs: password
echo $config['db_name']; // Outputs: database_name