This way of coding is called fluent interface.
return $this returns the current object, so you can call multiple function as single object/line
code like this: do you know about method chaining if no ,then you can find here :)
instead of:
Here is you can find real example <?php
class a{
public $name='';
public function setName($name){
$this->name=$name;
return $this;
}
public function getName(){
$this->name;
return $this;
}
}
?>
Hope this class may help you :)
|
Application development and sharing our knowledge to developer to developer for helping knowledge to build a effective solution for web architect.
Pages
▼
No comments:
Post a Comment