Attributes/AppStatic

From PhalangerWiki

Jump to: navigation, search

Phalanger extends syntax of PHP because of .NET interoperability possibilities. One of the syntactic extensions allows you to mark fields, classes and functions with attributes.

AppStatic attribute marks static class fields to be static across all the requests. Actually it results in classic static variable, which value lives across requests.

class X
{
    [\AppStatic]
    static $x;
}