PHP cannot save variable values ββbetween requests. This means that every time you call the script, $bool -variable will be set to true. If you want to keep the value between requests, you must use sessions or, if you want the variable to be shared between sessions, some APC or Memcache caching mechanism.
In addition, static used in PHP to declare a variable shared at the class level. Thus, it is used in classes and is available as self::$variableName; or Foo::$variableName
Read more about static properties here . From the docs:
Declaring class properties or methods as static makes them available without having to instantiate the class. A property declared as static cannot be accessed using an instance of a class object (although a static method can be used).
Also note that the word static was overloaded with PHP 5.3, and can also be used to denote Late Static Binding , by using static::
PatrikAkerstrand
source share