Welcome Guest, Not a member yet? Register   Sign In
Constants versus config items
#1

[eluser]nuwanda[/eluser]
I just advised someone to use config/constants for global data as opposed to loading a config item as needed.

So, in CI, what's the difference? If I need global settings is using a constant the solution to discretely loading a config item?
#2

[eluser]bretticus[/eluser]
It's the same rule for any PHP coding (and many other languages.) If you anticipate the values ever changing during script execution ($config['base_url'], database config, etc.) use $config. If the value will only ever be set once, define it as a constant instead.




Theme © iAndrew 2016 - Forum software by © MyBB