public function getWordCount($word) { $total = 0; foreach ($this->words as $w) { if ($w['word'] == $word) { $total++; } } return $total; }