3v4l.org

run code in 300+ PHP versions simultaneously
<?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>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.5.90.0030.04717.23
5.5.80.0030.04017.23
5.5.70.0100.03717.18
5.5.60.0030.03717.22
5.5.50.0070.03317.18
5.5.40.0000.04017.22
5.5.30.0000.04017.18
5.5.20.0030.04017.32
5.5.10.0000.04017.15
5.5.00.0070.04017.24
5.4.250.0100.03018.88
5.4.240.0030.04019.02
5.4.230.0070.04019.04
5.4.220.0030.04019.00
5.4.210.0030.03718.88
5.4.200.0030.03719.26
5.4.190.0030.05719.04
5.4.180.0000.05019.04
5.4.170.0000.04018.94
5.4.160.0070.03719.01
5.4.150.0030.07718.99
5.4.140.0100.03716.38
5.4.130.0030.07316.38
5.4.120.0070.06316.34
5.4.110.0100.05016.59
5.4.100.0030.07716.41
5.4.90.0030.07316.38
5.4.80.0100.04316.39
5.4.70.0030.06316.22
5.4.60.0070.07016.41
5.4.50.0030.07316.38
5.4.40.0030.05016.50
5.4.30.0000.07716.39
5.4.20.0100.06716.37
5.4.10.0130.05016.34
5.4.00.0070.07715.96
5.3.280.0030.03714.56
5.3.270.0030.03714.59
5.3.260.0130.07014.55
5.3.250.0070.07714.54
5.3.240.0070.06714.46
5.3.230.0070.07314.43
5.3.220.0130.03714.38
5.3.210.0100.05314.54
5.3.200.0170.07014.51
5.3.190.0200.06714.34
5.3.180.0170.03714.49
5.3.170.0000.04314.52
5.3.160.0200.06714.41
5.3.150.0070.08014.49
5.3.140.0130.07314.53
5.3.130.0000.08714.52
5.3.120.0100.07014.48
5.3.110.0030.07314.56
5.3.100.0030.04714.00
5.3.90.0030.05713.99
5.3.80.0070.04713.97
5.3.70.0070.03714.09
5.3.60.0100.07313.91
5.3.50.0070.07713.94
5.3.40.0030.06714.03
5.3.30.0070.07013.84
5.3.20.0070.05313.56
5.3.10.0130.06713.43
5.3.00.0030.07713.63

preferences:
144.24 ms | 1394 KiB | 7 Q