public function getRow($n) { if ($n == 1) { return new Row(array(1)); } $thePreviousRow = $this->getRow($n - 1); $theRow = new Row(); for ($i = 0; $i < $n; $i++) { $theRow->set($i, $thePreviousRow->get($i - 1) + $thePreviousRow->get($i)); } return $theRow; }