Possible Duplicate:
what is the difference between “GLOBAL” and “STATIC” variable in php
if we create a static variable inside a function, this variable exists in further using of the function… and as far as I know global variable does the same.
now what’s the benefit of using static variables?
The lexical scope of a
staticstatic variable is restricted to the function body – you cannot access the variable outside the function.However, its value will be remembered across multiple calls of the same function.
Global variables exist in global scope and can be accessed from anywhere in your code (you have to use the
globalkeyword or$GLOBALSarray inside functions though)