Browsing in other people code can be an interesting experience. Sometimes you learn stuff, other times you just get scared of the things you see. One recent observation I seem to make a lot, is that handling “application configuration” is often handled less gracefully as a would have wished.
The plain basic configuration handling in many PHP applications seems to be creating a php-file and declare all configuration values in this file – then have all other scripts in the application include this one config file – and sure it works.
Getting inspired from Java, Ruby or some other object oriented world, others seems to make configuration classes a long with a load of methods to “get” the config values – and sure it works, but frankly in terms of efficiency, it massive waste of resources for a simple job.
I don’t know if people have forgotten – or even worse doesn’t know – about constants in PHP, but for basic configuration stuff – which aren’t ever supposed to change – they work pretty well and use far less resources on your system than both variables and configuration classes.