reddog Posted October 18, 2011 Share Posted October 18, 2011 This might is a newbie/stupid question. But, what does this operator below means? -> 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 */ ?> 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. Link to comment https://forums.phpfreaks.com/topic/249295-operator-question/#findComment-1280124 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.