are.ehibou.com

July 20, 2007

global or $_GLOBAL[] Versus local variables

Filed under: Side Notes,php — admin @ 10:29 pm

Did some tests and found out that scripts of type

$a=5;
function foo(){
global $a;
return $a +5;
}
foo();

have relatively bad performance ….

try to use something like

$a=5;
function foo($a){
return $a +5;
}
foo($a);

instead …

  • Share/Bookmark
« Newer Posts

Powered by WordPress