PHP OOP method chaining

PHP method chaining allows to call number of methods in chain form.

class Home{
	public function first(){
		echo "First function";
		return $this;
	}
	public function second(){
		echo "Second function";
		return $this;
	}
}

$h=new Home();
$h->first()->second();
© 2016 - 2022, All Rights are Reserved.