Closed syphernl closed 7 years ago
Thank you for suggestion. But can you be more precise in your advice? What is your technical suggestion so that I can improve?
Thanks
I think this issue can be closed. There's no reason to get rid of globals for the sake of getting rid of globals - as long as they're used wisely and sparingly (among the dozens of great posts on this topic, http://tjhunt.blogspot.com/2009/04/php-global-variables-are-not.html is probably one of the best.)
I believe @syphernl is talking about things like
global $server, $user, $pass, $database, $pre;
at the start of admin.settings.php, but that isn't inherently bad.
Ignoring the installers and the 3rd party libraries, globals are used in:
And in these situations, it is always against the same variables.
My only suggestion, if someone else really feels the need to pick up this mantle, would be to merge "$server, $user, $pass, $database" into a single $dbConfig array and relabel $k to something more meaningful (such as $siteConfig.)
There are two things wrong with this: