function y() { $this->defined = 1; $this->undefinedButMagic = 2; $y->undefinedButNotInternal = 3; // static calls x::$y = 2; }
<?php class x { static function y() { } } x::Y(); x::x(); X::y(); x::y();
<?php class w { static $staticPropertyStatic = 2; static $staticPropertyx = 3; static $staticPropertyxFNS = 4; static $staticPropertyw = 31; static $staticPropertywFNS = 41; static $staticPropertyParent = 12; static $staticPropertyUnused = 5; } class x extends w { function y() { // self::$staticPropertySelf = 6; static::$staticPropertyStatic = 7; parent::$staticPropertyParent = 11; x::$staticPropertyx = 8; \x::$staticPropertyxFNS = 9; w::$staticPropertyw = 8; \w::$staticPropertywFNS = 9; \otherClass::$staticPropertyxFNS = 10; } } $x = new x(); $x->y();
<?php class x { static $staticReadWithSelf = array(1, 2, 3); static $staticReadWithStatic = array(1, 2, 4); static $staticModifiedWithSelf = array(1, 2, 5); static $staticModifiedWithStatic = array(1, 2, 6); static $staticModifiedWithThis = array(1, 2, 7); function y() { $a = self::$staticReadWithSelf; $b = static::$staticReadWithStatic; $a = self::$staticModifiedWithSelf++; static::$staticModifiedWithStatic[] = 1; $this->staticModifiedWithThis = 1; } } $z = new x(); $z->y(); print x::$staticModifiedWithThis;