I have a class which is used by amfphp and I am using some other classes in it to do multiple tasks. I am curious that what will be the best practice to keep instances of those classes either global or within function scope.
for e.g.
For global variable $config. I use it like this in functions:
global $config;
For scope variable I do this.
$config = new Config();
now when my program runs it process the specific task and shutdown everything(I assume) and for another different task call same again.
Now which one is better and performance effective ?