Chris Dowell wrote:
Entirely off the top of my head, I would imagine it has to do with the scope of the variables in question.

When assigning a value to a variable, there must be some time spent resolving the scope in which that variable is valid, to see if the new value overwrites any existing value and to ensure that it is accessible from the correct places. As a superglobal, however, $_SESSION has a very specific and unchanging scope. If I were Zeev or Andi, I'd have added a little optimisation into ZE to check for trivial cases such as this and shortcut the tedious scoping.

I could be wrong, but this seems to be the most obvious explanation. Has anyone tried this with any other superglobals like $_POST or $_SERVER?

Just tried it, $_SESSION is certainly faster then $_POST, $_GET and $_SERVER:


Session var: 0.380021095276
GET var: 0.50522685051

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to