$foo = new FOO;
$foo->$bar()->$baz();
<?php
class FOO {
public function bar() {
echo "Method bar called" . PHP_EOL;
return $this;
}
public function baz() {
echo "Method baz called" . PHP_EOL;
return $this;
}
}
$foo = new FOO;
$foo->bar()->baz();