reddog Posted October 18, 2011 Share Posted October 18, 2011 This might is a newbie/stupid question. But, what does this operator below means? -> Quote Link to comment https://forums.phpfreaks.com/topic/249295-operator-question/ Share on other sites More sharing options...
MasterACE14 Posted October 18, 2011 Share Posted October 18, 2011 Object Operator. 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 */ ?> Quote Link to comment https://forums.phpfreaks.com/topic/249295-operator-question/#findComment-1280100 Share on other sites More sharing options...
creata.physics Posted October 18, 2011 Share Posted October 18, 2011 I did not know you could call multiple functions at once from the same class just by using extra operators. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/249295-operator-question/#findComment-1280124 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.