note 87904 added to language.operators
| From: | pgarvin76+php dot net at NOSPAMgmail dot com | Date: | Tue, 30 Dec 2008 00:43:52 +0000 |
| Subject: | note 87904 added to language.operators | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148661@lists.php.net to get a copy of this message | ||
Method chaining is read left to right (left associative):
<?php
class Test_Method_Chain
{
public function One()
{
echo "One" . PHP_EOL;
return $this;
}
public function Two()
{
echo "Two" . PHP_EOL;
return $this;
}
public function Three()
{
echo "Three" . PHP_EOL;
return $this;
}
}
$test = new Test_Method_Chain();
$test->One()->Two()->Three();
/* Ouputs:
One
Two
Three
*/
?>
----
Server IP: 69.147.83.197
Probable Submitter: 69.242.86.121
----
Manual Page -- http://www.php.net/manual/en/language.operators.php
Edit -- https://master.php.net/note/edit/87904
Del: integrated -- https://master.php.net/note/delete/87904/integrated
Del: useless -- https://master.php.net/note/delete/87904/useless
Del: bad code -- https://master.php.net/note/delete/87904/bad+code
Del: spam -- https://master.php.net/note/delete/87904/spam
Del: non-english -- https://master.php.net/note/delete/87904/non-english
Del: in docs -- https://master.php.net/note/delete/87904/in+docs
Del: other reasons-- https://master.php.net/note/delete/87904
Reject -- https://master.php.net/note/reject/87904
Search -- https://master.php.net/manage/user-notes.php