public static function foo() { $foo = new d(); d::$x = $foo; unset($foo); echo "Foo: "; echo d::$x = "main"; echo "\n"; var_dump(d::$x); }
$foo++; echo $foo; } static function sf() { static $foo = 0; $foo++; echo $foo; } } class d extends c { public $q = 30; } $x = new c(); $x->x(); $x->y(); $x->y(); $x->y(); $x->y(); $x = new d(); $x->x(); $x->y(); $x->y(); $x->y(); c::sf(); c::sf(); c::sf(); d::sf(); d::sf(); d::sf();
public $cpb2 = 2; } trait c1 { use b; public $cpc11 = 1; } trait c2 { use a; public $cpc21 = 1; } class d { use c1, c2; public $cpd1 = 1; public function x() { $this->cpa1; $this->cpa2; $this->cpb1; $this->cpb2; $this->cpc11; $this->cpc21; $this->cpd1; $this->cpe1; } } $d = new d(); $d->x();