Iam was browsing the code for OpenCart. I found a library class file called. config.class.php.
here is the code:
public function load($filename)
{
$file = SYS_CONFIG_DIR . $filename . '.php';
if(file_exists($file))
{
$cfg = array();
require($file);
$this->data = array_merge($this->data, $cfg);
}
else
{
trigger_error('Error: Could not load config ' . $filename . '!');
exit();
}
}
I can see it first tries to check if the file exist. then a creates a var ($cfg) as an array. then it requires the file. then it merges its. This is where i dont understand.
$this->data = array_merge($this->data, $cfg);
so my config file that i am loading into this class. how would i stucture it so it will be able to merge it with this system config class?