global or $_GLOBAL[] Versus local variables

Did some tests and found out that scripts of type
[code lang=”php”]
$a=5;
function foo(){
global $a;
return $a +5;
}
foo();
[/code] have relatively bad performance ….

try to use something like [code lang=”php”]
$a=5;
function foo($a){
return $a +5;
}
foo($a);
[/code] instead …

Leave a Reply