What does $this->somefunc()->someotherfunc() do ?
Posted: Tue Aug 31, 2010 10:57 pm
I've seen code where the usage is something like this:
I didn't think you could do this in php (ie: call a method from the result of another method) like this. Is there a specific name for doing this? I see it all the time in Zend's Framework.
Example from Zend:
Any help with explaining this would be greatly appreciated!
Code: Select all
public function foo() {
$this->somefunction("test string")->somefunction("test string2")->someotherfunction(1);
}
Example from Zend:
Code: Select all
$form->setAction('/user/login')
->setMethod('post')
->setEnctype(Zend_Form::ENCTYPE_MULTIPART);