Skip to content
Advertisement

Creating central config file with hundreds of defined names

I want to create a central config file, with a few hundred of defined setup configure names, that would be included with something like:

JavaScript

I want to write the php code in the config file as follows:

JavaScript

So when the above function is included with include file.php, I want function to all respond as if its the same as the following code:

JavaScript

I don’t want the include file to have a lot of extra characters or code, just pretty simple with a little code if needed above or below on other lines, so I can add one name line of a new configuration as needed. Its not a list of peoples names, sorry if that confused anyone.

Advertisement

Answer

The variable name or the: $variable Can all be the same name.

As long as the array name or the: $variable['array_name'] Is different words, then there is no need to make a long list of variables in a config file.

Note, make sure that you don’t have similar keys in your config file

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement