$a = new A ();
$a->lol('params')->kek('cheburek');
class Calc {
private $number = 0;
public function __construct($n){
$this->number = $n;
}
public function plus($n){
$this->number += $n;
return $this;
}
public function minus($n){
$this->number -= $n;
return $this;
}
public function result(){
return $this->number;
}
}
echo (new Calc(100))->plus(50)->minus(75)->result(); // 75
public function A()
{
...
return $this;
}
class A
{
public function lol($params) {
// ...
return $this;
}
public function kek($params) {
// ...
return $this;
}
}
class A
{
public function lol($params) {
$b = new B();
// ...
return $b;
}
}
class B
{
public function kek($params) {
// ...
}
}
$a = new A();
$a->lol('params')->kek('cheburek');