我想知道是否有办法在PHP中新创建的对象上链接方法?
就像是:
class Foo { public function xyz() { ... return $this; } } $my_foo = new Foo()->xyz();
有人知道实现这个目标的方法吗?
php constructor new-operator method-chaining
constructor ×1
method-chaining ×1
new-operator ×1
php ×1