jatar_k - 3:23 am on Feb 12, 2013 (gmt 0)
1. whichever is the most readable and straight forward for someone later to understand is best, the difference in those 2 pieces would be negligible. Unless it is repeated a million times, which means it could probably be rewritten in a much more efficient way anyway.
2. not sure that's ever cost effective, extra db hit on every request to get vars? hard to say which is best for any software, when things are used system wide they should be somewhere central, preload them into some caching system or config file or db, depends.and yes, if the db is farther away it probably will take longer to talk to, ad if it's on every request then that can have a large impact.
3. i have seen both and measured them on specfic systems and I have chosen one or the other based on speed tests. Confusion is one of the biggest factors, also how easy it is to change. I like one central config that can then do the logic of what to include, which means every file has the same include and it never changes, then the including file can change anytime, central changes save time and resources.