I created an entire suite of PHP scripts using the values of $GLOBALS to control the functionality of my entire set of scripts.
Until I moved it to a client site where register_globals is turned OFF.
Of course, everything in $GLOBALS is no longer available, but how do I get everything from $GLOBALS back into their individual variables in order to be able to not have to write the following code snippet (and I am not kidding!!) 450 times:
foreach ($GLOBALS as $globalVar) {
if (is_array($globalVar)) {
foreach ($globalVar as $key => $val) if (!isset(${$key})) ${$key} = $val;
} else {
if (!isset(${$globalVar}) ${$globalVar} = $GLOBALS[$globalVar];
}
}
I would like to embed this script into a globally-available function since this script currently resides in a globally-included .inc.php file I wrote, however, the hierarchy of my setup is nearly pure OO. So you have scripts with average of 7 classes, each having an average of 15 methods/class. And there are about 5 scripts per project per client.
Get the picture? What do I do? This code works but not in method or function scope, obviously.
Phil