protected function getPrefixOfFirstDeclension($word, $last) { if (in_array($last, ['о', 'е', 'ё', 'ь', 'й'])) { $prefix = slice($word, 0, -1); } else { $prefix = $word; } return $prefix; }