DaveChild\TextStatistics\Syllables::wordsWithThreeSyllables PHP Method

wordsWithThreeSyllables() public static method

Returns the number of words with more than three syllables
public static wordsWithThreeSyllables ( string $strText, boolean $blnCountProperNouns = true, string $strEncoding = '' ) : integer
$strText string Text to be measured
$blnCountProperNouns boolean Boolean - should proper nouns be included in words count
$strEncoding string Encoding of text
return integer
    public static function wordsWithThreeSyllables($strText, $blnCountProperNouns = true, $strEncoding = '')
    {
        $intLongWordCount = 0;
        $intWordCount = Text::wordCount($strText, $strEncoding);
        $arrWords = explode(' ', $strText);
        for ($i = 0; $i < $intWordCount; $i++) {
            if (Syllables::syllableCount($arrWords[$i], $strEncoding) > 2) {
                if ($blnCountProperNouns) {
                    $intLongWordCount++;
                } else {
                    $strFirstLetter = Text::substring($arrWords[$i], 0, 1, $strEncoding);
                    if ($strFirstLetter !== Text::upperCase($strFirstLetter, $strEncoding)) {
                        // First letter is lower case. Count it.
                        $intLongWordCount++;
                    }
                }
            }
        }
        return $intLongWordCount;
    }