Method Chaining
<?php
class Abc
{
public function first()
{
echo "This is First Function" . "<br>";
return $this;
}
public function second()
{
echo "This is Second Function" . "<br>";
return $this;
}
public function third()
{
echo "This is Third Function" . "<br>";
return $this;
}
}
$test = new Abc();
$test->first()->second()->third();
// OUTPUT:
//This is First Function
// This is Second Function
// This is Third Function
?>
Comments
Post a Comment