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>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 141
Branch analysis from position: 141
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 36, Position 2 = 48
Branch analysis from position: 36
2 jumps found. (Code = 78) Position 1 = 37, Position 2 = 48
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 48
2 jumps found. (Code = 77) Position 1 = 71, Position 2 = 85
Branch analysis from position: 71
2 jumps found. (Code = 78) Position 1 = 72, Position 2 = 85
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
Branch analysis from position: 85
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 85
Branch analysis from position: 48
filename:       /in/LmmHs
function name:  (null)
number of ops:  147
compiled vars:  !0 = $defolttext, !1 = $text, !2 = $clearbrpbi, !3 = $cleartext, !4 = $words, !5 = $curword, !6 = $allwords, !7 = $curwordsylamt, !8 = $wor, !9 = $wordsylamtall, !10 = $v, !11 = $k, !12 = $wordssenarr, !13 = $nospaces, !14 = $nospaceslen, !15 = $syllablesamt, !16 = $sentences, !17 = $sentencesamt, !18 = $senwords, !19 = $sen, !20 = $wordssenamt, !21 = $wordssenamtall, !22 = $avg_sense_length_inwords, !23 = $avg_words_length_insyllables, !24 = $ASL, !25 = $ASW, !26 = $wordsamt, !27 = $textlen, !28 = $FRE1, !29 = $FRE2, !30 = $FleschKincaidGradeLevel
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, ''
    3     1        INIT_FCALL                                               'error_reporting'
          2        SEND_VAL                                                 -1
          3        DO_ICALL                                                 
    4     4        FETCH_W                      global              $33     '_REQUEST'
          5        ASSIGN_DIM                                               $33, 'submit'
          6        OP_DATA                                                  'submit'
    5     7        FETCH_W                      global              $35     '_REQUEST'
          8        ASSIGN_DIM                                               $35, 'text'
          9        OP_DATA                                                  'While+the+fog+index+is+a+good+sign+of+hard-to-read+text%2C+it+has+limits.+Not+all+complex+words+are+difficult.+For+example%2C+asparagus+is+not+generally+thought+to+be+a+difficult+word%2C+though+it+has+four+syllables.+A+short+word+can+be+difficult+if+it+is+not+used+very+often+by+most+people.%0AUntil+the+1980s%2C+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%2C+it+assumed+people+saw+each+clause+as+a+complete+thought.%0AIn+the+1980s%2C+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.%0ANevertheless%2C+some+continue+to+point+out+that+a+series+of+simple%2C+short+sentences+does+not+mean+that+the+reading+is+easier.+In+some+works%2C+such+as+Gibbon%27s+The+History+of+the+Decline+and+Fall+of+the+Roman+Empire%2C+the+fog+scores+using+the+old+and+revised+algorithms+differ+greatly.+A+sample+test+took+a+random+footnote+from+the+text%3A+%28Dion%2C+vol.+I.+lxxix.+p.+1363.+Herodian%2C+l.+v.+p.+189.%29+and+used+an+automated+Gunning+Fog+site%2C+first+using+the+sentence+count%2C+and+then+the+count+of+sentences+plus+clauses.+The+site+gave+an+index+of+19.2+using+only+sentences%2C+and+an+index+of+12.5+when+including+independent+clauses.+This+brought+down+the+fog+index+from+post-graduate+to+high+school.'
   10    10        FETCH_IS                                         ~37     '_REQUEST'
         11        ISSET_ISEMPTY_DIM_OBJ                         0  ~38     ~37, 'submit'
         12        BOOL_NOT                                         ~39     ~38
         13      > JMPZ                                                     ~39, ->16
   11    14    >   ASSIGN                                                   !1, ''
         15      > JMP                                                      ->141
   14    16    >   FETCH_R                      global              ~41     '_REQUEST'
         17        FETCH_DIM_R                                      ~42     ~41, 'text'
         18        ASSIGN                                                   !1, ~42
   15    19        ASSIGN                                                   !2, <array>
   17    20        INIT_FCALL                                               'strtr'
         21        SEND_VAR                                                 !1
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $45     
         24        ASSIGN                                                   !3, $45
   18    25        INIT_FCALL                                               'explode'
         26        SEND_VAL                                                 '+'
         27        SEND_VAR                                                 !3
         28        DO_ICALL                                         $47     
         29        ASSIGN                                                   !4, $47
   19    30        ASSIGN                                                   !5, ''
   20    31        ASSIGN                                                   !6, ''
   21    32        ASSIGN                                                   !7, 0
   22    33        ASSIGN                                                   !8, 0
   23    34        ASSIGN                                                   !9, 0
   24    35      > FE_RESET_R                                       $54     !4, ->48
         36    > > FE_FETCH_R                                       ~55     $54, !10, ->48
         37    >   ASSIGN                                                   !11, ~55
   25    38        ASSIGN                                                   !5, !10
   26    39        STRLEN                                           ~58     !5
         40        DIV                                              ~59     ~58, 2.5
         41        ASSIGN                                                   !7, ~59
   27    42        ASSIGN_DIM                                               !12
         43        OP_DATA                                                  !7
   28    44        ASSIGN_OP                                     8          !6, !5
   29    45        ASSIGN_OP                                     1          !9, !7
   30    46        PRE_INC                                                  !8
   24    47      > JMP                                                      ->36
         48    >   FE_FREE                                                  $54
   32    49        INIT_FCALL                                               'implode'
         50        SEND_VAL                                                 ''
         51        SEND_VAR                                                 !4
         52        DO_ICALL                                         $65     
         53        ASSIGN                                                   !13, $65
   33    54        STRLEN                                           ~67     !13
         55        ASSIGN                                                   !14, ~67
   34    56        DIV                                              ~69     !14, 2.5
         57        ASSIGN                                                   !15, ~69
   35    58        INIT_FCALL                                               'explode'
         59        SEND_VAL                                                 '.'
         60        SEND_VAR                                                 !3
         61        DO_ICALL                                         $71     
         62        ASSIGN                                                   !16, $71
   36    63        COUNT                                            ~73     !16
         64        ASSIGN                                                   !17, ~73
   37    65        ASSIGN                                                   !18, <array>
   38    66        ASSIGN                                                   !12, <array>
   39    67        ASSIGN                                                   !19, 0
   40    68        ASSIGN                                                   !20, 0
   41    69        ASSIGN                                                   !21, 0
   42    70      > FE_RESET_R                                       $80     !16, ->85
         71    > > FE_FETCH_R                                       ~81     $80, !10, ->85
         72    >   ASSIGN                                                   !11, ~81
   43    73        INIT_FCALL                                               'explode'
         74        SEND_VAL                                                 '+'
         75        SEND_VAR                                                 !10
         76        DO_ICALL                                         $83     
         77        ASSIGN                                                   !18, $83
   44    78        COUNT                                            ~85     !18
         79        ASSIGN                                                   !20, ~85
   45    80        ASSIGN_DIM                                               !12
         81        OP_DATA                                                  !20
   46    82        ASSIGN_OP                                     1          !21, !20
   47    83        PRE_INC                                                  !19
   42    84      > JMP                                                      ->71
         85    >   FE_FREE                                                  $80
   49    86        DIV                                              ~90     !21, !19
         87        ASSIGN                                                   !22, ~90
   50    88        INIT_FCALL                                               'array_sum'
         89        SEND_VAR                                                 !12
         90        DO_ICALL                                         $92     
         91        DIV                                              ~93     $92, !8
         92        ASSIGN                                                   !23, ~93
   51    93        ASSIGN                                                   !24, !22
   52    94        ASSIGN                                                   !25, !23
   53    95        COUNT                                            ~97     !4
         96        ASSIGN                                                   !26, ~97
   54    97        STRLEN                                           ~99     !3
         98        ASSIGN                                                   !27, ~99
   56    99        DIV                                              ~101    !26, !17
        100        MUL                                              ~102    ~101, 1.015
        101        SUB                                              ~103    206.835, ~102
        102        DIV                                              ~104    !15, !26
        103        MUL                                              ~105    ~104, 84.6
        104        SUB                                              ~106    ~103, ~105
        105        ASSIGN                                                   !28, ~106
   58   106        MUL                                              ~108    !24, 1.015
        107        SUB                                              ~109    206.835, ~108
        108        MUL                                              ~110    !25, 84.6
        109        SUB                                              ~111    ~109, ~110
        110        ASSIGN                                                   !29, ~111
   60   111        DIV                                              ~113    !26, !17
        112        MUL                                              ~114    ~113, 0.39
        113        DIV                                              ~115    !15, !26
        114        MUL                                              ~116    ~115, 11.8
        115        ADD                                              ~117    ~114, ~116
        116        SUB                                              ~118    ~117, 15.59
        117        ASSIGN                                                   !30, ~118
   62   118        ROPE_INIT                                    15  ~121    '%D0%A7%D0%B8%D1%82%D0%B0%D0%B5%D0%BC%D0%BE%D1%81%D1%82%D1%8C+%D0%B2%D0%B0%D1%88%D0%B5%D0%B3%D0%BE+%D1%82%D0%B5%D0%BA%D1%81%D1%82%D0%B0+%D1%80%D0%B0%D0%B2%D0%BD%D0%B0+FRE1+%3D+'
        119        ROPE_ADD                                      1  ~121    ~121, !28
        120        ROPE_ADD                                      2  ~121    ~121, '+%2CFRE2+%3D+'
        121        ROPE_ADD                                      3  ~121    ~121, !29
        122        ROPE_ADD                                      4  ~121    ~121, '%3Cbr+%2F%3E%3Cbr+%2F%3E%0A%09%D0%A7%D0%B8%D1%82%D0%B0%D0%B5%D0%BC%D0%BE%D1%81%D1%82%D1%8C+%D0%B2%D0%B0%D1%88%D0%B5%D0%B3%D0%BE+%D1%82%D0%B5%D0%BA%D1%81%D1%82%D0%B0+%D0%BF%D0%BE+Flesch%E2%80%93Kincaid+Grade+Level+%D1%80%D0%B0%D0%B2%D0%BD%D0%B0+%0A%09FleschKincaidGradeLevel%3D+0.39%28wordsamt%2Fsentencesamt%29%2B11.8%28syllablesamt%2Fwordsamt%29-15.59+%3D+0.39%28'
   64   123        ROPE_ADD                                      5  ~121    ~121, !26
        124        ROPE_ADD                                      6  ~121    ~121, '%5C%2F'
        125        ROPE_ADD                                      7  ~121    ~121, !17
        126        ROPE_ADD                                      8  ~121    ~121, '%29%5C%2B11.8%5C%28'
        127        ROPE_ADD                                      9  ~121    ~121, !15
        128        ROPE_ADD                                     10  ~121    ~121, '%5C%2F'
        129        ROPE_ADD                                     11  ~121    ~121, !26
        130        ROPE_ADD                                     12  ~121    ~121, '%29%5C-15.59+%3D+'
        131        ROPE_ADD                                     13  ~121    ~121, !30
        132        ROPE_END                                     14  ~120    ~121, '%0A%09%3Cbr+%2F%3E%3Cbr+%2F%3E%0A%09%0A%09%3Cpre%3E'
   67   133        INIT_FCALL                                               'print_r'
        134        FETCH_R                      global              ~129    'GLOBALS'
        135        SEND_VAL                                                 ~129
        136        SEND_VAL                                                 <true>
        137        DO_ICALL                                         $130    
        138        CONCAT                                           ~131    ~120, $130
        139        CONCAT                                           ~132    ~131, '%3C%2Fpre%3E'
   62   140        ASSIGN                                                   !1, ~132
   71   141    >   ECHO                                                     '%0A%3C%21DOCTYPE+html+PUBLIC+%22-%2F%2FW3C%2F%2FDTD+XHTML+1.0+Strict%2F%2FEN%22+%22http%3A%2F%2Fwww.w3.org%2FTR%2Fxhtml1%2FDTD%2Fxhtml1-strict.dtd%22%3E%0A%0A%3Chtml++xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22+xml%3Alang%3D%22ru%22+lang%3D%22ru%22%3E%0A%0A%0A%3Cbody%3E%0A%3Ch2%3E%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0+%D1%87%D0%B8%D1%82%D0%B0%D0%B5%D0%BC%D0%BE%D1%81%D1%82%D0%B8+%D1%82%D0%B5%D0%BA%D1%81%D1%82%D0%B0+%D0%BF%D0%BE+%D0%B8%D0%BD%D0%B4%D0%B5%D0%BA%D1%81%D1%83+%D0%A4%D0%BB%D0%B5%D1%88%D0%B0%3C%2Fh2%3E%3Cbr+%2F%3E%0A'
   79   142        ECHO                                                     !1
   80   143        ECHO                                                     '%3Cbr+%2F%3E%0A%3Cbr+%2F%3E%0A%3Cform+action%3D%22%22+method%3Dpost%3E%0A%D0%92%D0%B2%D0%B2%D0%B5%D0%B4%D0%B8%D1%82%D0%B5+%D1%82%D0%B5%D0%BA%D1%81%D1%82%D0%B0+%D1%83+%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D0%BE%D0%B3%D0%BE+%D0%BD%D1%83%D0%B6%D0%BD%D0%BE+%D0%BF%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%B8%D1%82%D1%8C+%D1%87%D0%B8%D1%82%D0%B0%D0%B5%D0%BC%D0%BE%D1%81%D1%82%D1%8C%3A%3Cbr+%2F%3E%0A%09%09%09%3Ctextarea+name%3D%22text%22+rows%3D%2210%22+cols%3D%2245%22%3E+'
   84   144        ECHO                                                     !0
        145        ECHO                                                     '%3C%2Ftextarea%3E%3Cbr+%2F%3E%0A%09%09%09%3Cinput+type%3D%27submit%27+name%3D%27submit%27+value%3D%27%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%B8%D1%82%D1%8C%27+%2F%3E%0A%3Chr%3E%0A%3C%2Fform%3E%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   89   146      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.33 ms | 1412 KiB | 25 Q