Monday, 20 May 2013

PHP performance with global and local variable instantiation

PHP performance with global and local variable instantiation

I have a large number of PHP functions that are taking $GLOBALS['foo'] and instantiating it local to that function like this
$foo = $GLOBALS['foo'];
I'm aware that this is a performance hit to some degree, but am wondering if someone can lend insight into how serious this is in terms of performance hit. Obviously with limited line length in a strict code style guideline,
$my_long_function_name
is preferable to
$GLOBALS['my_long_function_name']
I'm just curious what kind of performance hit this represents and if there are other factors at work I might have overlooked.

No comments:

Post a Comment