-- Robert Castley <[email protected]> wrote (on Monday, 05 January 2009, 09:47 AM -0000): > Out of the two following examples which is the most efficient code i.e. which > offers the best performance? > > Example 1: > > > $sql = $this->select() > ->from($this->_name) > ->order('timestamp', 'DESC'); > > > > Example 2: > > $sql = $this->select(); > $sql->from($this->_name); > $sql->order('timestamp', 'DESC');
Same performance. Method chaining is exactly the same internally as simply calling the methods individually. It's simply a code formatting idiom (I usually line up the -> on subsequent lines to show which object is being acted on). -- Matthew Weier O'Phinney Software Architect | [email protected] Zend Framework | http://framework.zend.com/
