/** * Gives the number of rows in the result set. * * Part of the Countable interface. * * @return int */ public function count() { if ($this->_count !== null) { return $this->_count; } if ($this->_statement) { return $this->_count = $this->_statement->rowCount(); } return $this->_count = count($this->_results); }