3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * For this test someone has written a lot of crap PHP code! * List all the problems you can find with this code and why it is a problem * */ function countVowelsInFile($f) { $handle = fopen($f); while (!feof($handle)) $buf = fgets($handle, 4096); for ($i = 0; $i < strlen($buf); $i++) { if ($buf[$i] == 'a') $a++; if ($buf[$i] == 'e') $e++; if ($buf[$i] == 'i') $i++; if ($buf[$i] == 'o') $o++; if ($buf[$i] == 'u') $u++; if ($buf[$i] == 'e') $e++; } fclose($handle); return $a + $e + $i + $o + $u; } countVowelsInFile(__FILE__);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B7BF7
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                               'countvowelsinfile'
          1        SEND_VAL                                                 '%2Fin%2FB7BF7'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function countvowelsinfile:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 6
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 18
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 30
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 34
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 38
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 42
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 18
Branch analysis from position: 46
Branch analysis from position: 18
Branch analysis from position: 42
Branch analysis from position: 38
Branch analysis from position: 34
Branch analysis from position: 30
Branch analysis from position: 26
Branch analysis from position: 22
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 6
Branch analysis from position: 16
Branch analysis from position: 6
filename:       /in/B7BF7
function name:  countVowelsInFile
number of ops:  55
compiled vars:  !0 = $f, !1 = $handle, !2 = $buf, !3 = $i, !4 = $a, !5 = $e, !6 = $o, !7 = $u
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'fopen'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $8      
          4        ASSIGN                                                   !1, $8
   11     5      > JMP                                                      ->11
          6    >   INIT_FCALL                                               'fgets'
          7        SEND_VAR                                                 !1
          8        SEND_VAL                                                 4096
          9        DO_ICALL                                         $10     
         10        ASSIGN                                                   !2, $10
         11    >   INIT_FCALL                                               'feof'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $12     
         14        BOOL_NOT                                         ~13     $12
         15      > JMPNZ                                                    ~13, ->6
   13    16    >   ASSIGN                                                   !3, 0
         17      > JMP                                                      ->43
   15    18    >   FETCH_DIM_R                                      ~15     !2, !3
         19        IS_EQUAL                                                 ~15, 'a'
         20      > JMPZ                                                     ~16, ->22
         21    >   PRE_INC                                                  !4
   16    22    >   FETCH_DIM_R                                      ~18     !2, !3
         23        IS_EQUAL                                                 ~18, 'e'
         24      > JMPZ                                                     ~19, ->26
         25    >   PRE_INC                                                  !5
   17    26    >   FETCH_DIM_R                                      ~21     !2, !3
         27        IS_EQUAL                                                 ~21, 'i'
         28      > JMPZ                                                     ~22, ->30
         29    >   PRE_INC                                                  !3
   18    30    >   FETCH_DIM_R                                      ~24     !2, !3
         31        IS_EQUAL                                                 ~24, 'o'
         32      > JMPZ                                                     ~25, ->34
         33    >   PRE_INC                                                  !6
   19    34    >   FETCH_DIM_R                                      ~27     !2, !3
         35        IS_EQUAL                                                 ~27, 'u'
         36      > JMPZ                                                     ~28, ->38
         37    >   PRE_INC                                                  !7
   20    38    >   FETCH_DIM_R                                      ~30     !2, !3
         39        IS_EQUAL                                                 ~30, 'e'
         40      > JMPZ                                                     ~31, ->42
         41    >   PRE_INC                                                  !5
   13    42    >   PRE_INC                                                  !3
         43    >   STRLEN                                           ~34     !2
         44        IS_SMALLER                                               !3, ~34
         45      > JMPNZ                                                    ~35, ->18
   22    46    >   INIT_FCALL                                               'fclose'
         47        SEND_VAR                                                 !1
         48        DO_ICALL                                                 
   24    49        ADD                                              ~37     !4, !5
         50        ADD                                              ~38     ~37, !3
         51        ADD                                              ~39     ~38, !6
         52        ADD                                              ~40     ~39, !7
         53      > RETURN                                                   ~40
   25    54*     > RETURN                                                   null

End of function countvowelsinfile

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.13 ms | 1407 KiB | 22 Q