<?php class X { public function y() { echo "y\n"; return $this; } public function z() { echo "z\n"; return $this; } public function a($n) { return $n; } } $x = new X(); echo $x->y()->z()->a(1);
<?php class x { static function y() { } } x::Y(); x::x(); X::y(); x::y();
<?php X::$y = array(); X::$y[4] = 4; X::$y[44] = 44; X::$y[444] = 444; Y::$y = []; Y::$y[] = 5; Y::$y[] = 55; Y::$y[] = 555; Z::$y = array(); Z::$z[] = 5; Z::$z[] = 55; Z::$z[] = 555;
<?php class X { static $y = array(1, 2, 3); static function go() { unset(self::$y[0]); } static function y() { return self::$y; } } X::go(); var_dump(X::y());
function y() { return new X(); } } function b() { return new X(); } $y = "x"; $z = "y"; $x = new X(); $x->x = new X(); $x->x; $x->{$y}; $x->x(); $x->{$y}(); $x->{${$z}}; $x->x->x; $x->{$y}->{$y}; $x->y()->x(); $x->{$z}()->{$y}(); $x->a[3]; $x->a[3](); // Precedence inversion $x->a[3]()->a[3]; // Precedence inversion $x->a[3]()->a[3](); // Precedence inversion (twice) $x->{2 + 3}; // $x->{2 + 3}(); // moved to unsupported