Encounted (Warning: invalid line offset) when creating the configuration for the site

I like this configuration because it is cleaner, so I have a configuration file with the following:

<?php
 $Config['option_1'] = 'some value';
 $Config['option_2'] = 'some value';
 $Config['option_3'] = 'some value';
?>

Then I have a class with a method for loading such configuration files. This is very similar to how CodeIgniter loads configuration files, unless I include this file that I get:

Warning: Illegal string offset 'option_1' in 'Path to the config file' on line #.
Warning: Illegal string offset 'option_2' in 'Path to the config file' on line #.
Warning: Illegal string offset 'option_3' in 'Path to the config file' on line #.

etc .. you get the idea.

I searched everywhere about how to use such a configuration system on the site, but with no result. Therefore, if anyone has a link to a tutorial or documentation on this, please help me understand how this works or why I get this error when I need a configuration file from a class using one of its methods.

. , , , "echo $Config ['option_1'];"

+3
1

var_dump($Config);

, , .

-3

All Articles