run code in 150+ php & hhvm versions
Bugs & Features
<?php $defolttext = ""; error_reporting(-1); $_REQUEST['submit'] = "submit"; $_REQUEST['text'] = "While the fog index is a good sign of hard-to-read text, it has limits. Not all complex words are difficult. For example, asparagus is not generally thought to be a difficult word, though it has four syllables. A short word can be difficult if it is not used very often by most people. Until the 1980s, the fog index was calculated differently. The original formula counted each clause as a sentence. Because the index was meant to measure clarity of expression within sentences, it assumed people saw each clause as a complete thought. In the 1980s, this step was left out in counting the fog index for literature. This might have been because it had to be done manually. Judith Bogert of Pennsylvania State University defended the original algorithm in 1985. A review of subsequent literature shows that the newer method is generally recommended. Nevertheless, some continue to point out that a series of simple, short sentences does not mean that the reading is easier. In some works, such as Gibbon's The History of the Decline and Fall of the Roman Empire, the fog scores using the old and revised algorithms differ greatly. A sample test took a random footnote from the text: (Dion, vol. I. lxxix. p. 1363. Herodian, l. v. p. 189.) and used an automated Gunning Fog site, first using the sentence count, and then the count of sentences plus clauses. The site gave an index of 19.2 using only sentences, and an index of 12.5 when including independent clauses. This brought down the fog index from post-graduate to high school."; if (!isset($_REQUEST['submit'])) { $text = ""; } else{ $text = $_REQUEST['text']; $clearbrpbi = array("<br>" => " ", "<br />" => " ", "<p>" => " ", "</p>" => "", "<i>" => "", "</i>" => "", "<b>" => "", "</b>" => "", "<" => "", ">" => "", '"' => ''); $cleartext = strtr($text, $clearbrpbi); $words = explode(" ", $cleartext); $curword = ""; $allwords = ""; $curwordsylamt = 0; $wor = 0; $wordsylamtall = 0; foreach ($words as $k => $v){ $curword = $v; $curwordsylamt = strlen($curword)/2.5;//количество слогов в текущем слове $wordssenarr[] = $curwordsylamt; $allwords .= $curword; $wordsylamtall += $curwordsylamt; $wor++;//счетчик слов } $nospaces = implode("", $words); $nospaceslen = strlen($nospaces);//общеее количество букв без пробелов $syllablesamt = $nospaceslen/2.5; $sentences = explode(".", $cleartext); $sentencesamt = count($sentences); $senwords = array(); $wordssenarr = array(); $sen = 0; $wordssenamt = 0; $wordssenamtall = 0; foreach ($sentences as $k => $v){ $senwords = explode(" ", $v); $wordssenamt = count($senwords);//количество слов в текущем предложении $wordssenarr[] = $wordssenamt; $wordssenamtall += $wordssenamt; $sen++;//счетчик предложений } $avg_sense_length_inwords = $wordssenamtall/$sen; $avg_words_length_insyllables = array_sum($wordssenarr)/$wor; $ASL = $avg_sense_length_inwords; $ASW = $avg_words_length_insyllables; $wordsamt = count($words); $textlen = strlen($cleartext); $FRE1 = 206.835 - 1.015*($wordsamt/$sentencesamt) - 84.6*($syllablesamt/$wordsamt); $FRE2 = 206.835 - (1.015*$ASL) - (84.6*$ASW); //$FleschKincaidGradeLevel= 0.39*(total words/total sentences)+11.8*(total syllables/total words)-15.59; $FleschKincaidGradeLevel= 0.39*($wordsamt/$sentencesamt)+11.8*($syllablesamt/$wordsamt)-15.59; $text = "Читаемость вашего текста равна FRE1 = $FRE1 ,FRE2 = $FRE2<br /><br /> Читаемость вашего текста по Flesch–Kincaid Grade Level равна FleschKincaidGradeLevel= 0.39(wordsamt/sentencesamt)+11.8(syllablesamt/wordsamt)-15.59 = 0.39($wordsamt\/$sentencesamt)\+11.8\($syllablesamt\/$wordsamt)\-15.59 = $FleschKincaidGradeLevel <br /><br /> <pre>".print_r($GLOBALS, true)."</pre>"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru"> <body> <h2>Проверка читаемости текста по индексу Флеша</h2><br /> <?php echo $text; ?> <br /> <br /> <form action="" method=post> Ввведите текста у которого нужно проверить читаемость:<br /> <textarea name="text" rows="10" cols="45"> <?php echo $defolttext; ?></textarea><br /> <input type='submit' name='submit' value='Проверить' /> <hr> </form> </body> </html>

Abusive script

This script was stopped while abusing our resources