How can the array from a configuration file be accessed in another PHP file without including it multiple times?

To access the array from a configuration file in another PHP file without including it multiple times, you can use PHP's `include_once` or `require_once` function to include the configuration file only once. This ensures that the array is loaded into memory and can be accessed in any other PHP file without duplication.

// config.php
<?php
$config = [
    'database' => 'localhost',
    'username' => 'root',
    'password' => 'password'
];
?>

// index.php
<?php
require_once 'config.php';

// Access the configuration array
echo $config['database']; // Output: localhost
echo $config['username']; // Output: root
echo $config['password']; // Output: password
?>