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, 'r'); 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/DgbMG
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%2FDgbMG'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

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

End of function countvowelsinfile

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.12 ms | 1403 KiB | 22 Q