3v4l.org

run code in 300+ PHP versions simultaneously
<?php $query = "SELECT TABLE FROM FZC WHERE TABLE='chandz' AND TABLE=1 OR DIE='52'"; $strpos_where = strpos($query, 'WHERE') + 6; $strpos_limit = (int) strpos($query, 'LIMIT'); $strpos_group = (int) strpos($query, 'GROUP BY'); $strpos_order = (int) strpos($query, 'ORDER BY'); if($strpos_limit > 0 AND $strpos_limit > $strpos_group AND $strpos_limit > $strpos_order) { $where = substr($query, $strpos_where, $strpos_limit); } elseif($strpos_group > 0 AND $strpos_group > $strpos_limit AND $strpos_group > $strpos_order) { $where = substr($query, $strpos_where, $strpos_group); } elseif($strpos_order > 0 AND $strpos_order > $strpos_limit AND $strpos_order > $strpos_group) { $where = substr($query, $strpos_where, $strpos_order); } else { $where = substr($query, $strpos_where); } $new_query = substr($query, 0, $strpos_where); $where_built = ""; $where_values = array(); $where_break = explode(' AND ', $where); $where_break_c = count($where_break); for($i = 0; $i < $where_break_c; $i++) { if(!isset($where_break[$i])) { continue; } $clausel = $where_break[$i]; if(isset($where_break[$i + 1]) AND preg_match('/([\`a-z0-9\_\-]+)[\s]{0,1}(\=|LIKE|\<|\>|\<\=|\>\=|!\=)[\s]{0,1}(.*)/i', $where_break[$i + 1]) != 1) { $where_break[$i] = $where_break[$i]." AND ".$where_break[$i + 1]; $clausel = $where_break[$i]; unset($where_break[$i + 1]); } $where_break_or = explode(' OR ', $clausel); $where_break_or_c = count($where_break_or); for($j = 0; $j < $where_break_or_c; $j++) { if(!isset($where_break_or[$i])) { continue; } $clausel2 = $where_break_or[$j]; if(isset($where_break_or[$j + 1]) AND preg_match('/([\`a-z0-9\_\-]+)[\s]{0,1}(\=|LIKE|\<|\>|\<\=|\>\=|!\=)[\s]{0,1}(.*)/i', $where_break_or[$j + 1]) != 1) { $where_break_or[$j] = $where_break_or[$j]." OR ".$where_break_or[$j + 1]; $clausel2 = $where_break_or[$j]; unset($where_break_or[$j + 1]); } preg_match('/([\`a-z0-9\_\-]+)[\s]{0,1}(\=|LIKE|\<|\>|\<\=|\>\=|!\=)[\s]{0,1}(.*)/i', $clausel2, $matches); var_dump($matches); } preg_match('/([\`a-z0-9\_\-]+)[\s]{0,1}(\=|LIKE|\<|\>|\<\=|\>\=|!\=)[\s]{0,1}(.*)/i', $clausel, $matches); var_dump($matches); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
2 jumps found. (Code = 46) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 40
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
1 jumps found. (Code = 42) Position 1 = 179
Branch analysis from position: 179
2 jumps found. (Code = 44) Position 1 = 181, Position 2 = 92
Branch analysis from position: 181
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 92
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 96
Branch analysis from position: 95
1 jumps found. (Code = 42) Position 1 = 178
Branch analysis from position: 178
2 jumps found. (Code = 44) Position 1 = 181, Position 2 = 92
Branch analysis from position: 181
Branch analysis from position: 92
Branch analysis from position: 96
2 jumps found. (Code = 46) Position 1 = 101, Position 2 = 109
Branch analysis from position: 101
2 jumps found. (Code = 43) Position 1 = 110, Position 2 = 121
Branch analysis from position: 110
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
2 jumps found. (Code = 44) Position 1 = 170, Position 2 = 130
Branch analysis from position: 170
2 jumps found. (Code = 44) Position 1 = 181, Position 2 = 92
Branch analysis from position: 181
Branch analysis from position: 92
Branch analysis from position: 130
2 jumps found. (Code = 43) Position 1 = 133, Position 2 = 134
Branch analysis from position: 133
1 jumps found. (Code = 42) Position 1 = 167
Branch analysis from position: 167
2 jumps found. (Code = 44) Position 1 = 170, Position 2 = 130
Branch analysis from position: 170
Branch analysis from position: 130
Branch analysis from position: 134
2 jumps found. (Code = 46) Position 1 = 139, Position 2 = 147
Branch analysis from position: 139
2 jumps found. (Code = 43) Position 1 = 148, Position 2 = 159
Branch analysis from position: 148
2 jumps found. (Code = 44) Position 1 = 170, Position 2 = 130
Branch analysis from position: 170
Branch analysis from position: 130
Branch analysis from position: 159
Branch analysis from position: 147
Branch analysis from position: 121
Branch analysis from position: 109
Branch analysis from position: 40
2 jumps found. (Code = 46) Position 1 = 42, Position 2 = 44
Branch analysis from position: 42
2 jumps found. (Code = 46) Position 1 = 45, Position 2 = 47
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 55
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
Branch analysis from position: 55
2 jumps found. (Code = 46) Position 1 = 57, Position 2 = 59
Branch analysis from position: 57
2 jumps found. (Code = 46) Position 1 = 60, Position 2 = 62
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 70
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 179
Branch analysis from position: 179
Branch analysis from position: 62
Branch analysis from position: 59
Branch analysis from position: 47
Branch analysis from position: 44
Branch analysis from position: 32
Branch analysis from position: 29
filename:       /in/8g9G3
function name:  (null)
number of ops:  182
compiled vars:  !0 = $query, !1 = $strpos_where, !2 = $strpos_limit, !3 = $strpos_group, !4 = $strpos_order, !5 = $where, !6 = $new_query, !7 = $where_built, !8 = $where_values, !9 = $where_break, !10 = $where_break_c, !11 = $i, !12 = $clausel, !13 = $where_break_or, !14 = $where_break_or_c, !15 = $j, !16 = $clausel2, !17 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'SELECT+TABLE+FROM+FZC+WHERE+TABLE%3D%27chandz%27+AND+TABLE%3D1+OR+DIE%3D%2752%27'
    3     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'WHERE'
          4        DO_ICALL                                         $19     
          5        ADD                                              ~20     $19, 6
          6        ASSIGN                                                   !1, ~20
    4     7        INIT_FCALL                                               'strpos'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 'LIMIT'
         10        DO_ICALL                                         $22     
         11        CAST                                          4  ~23     $22
         12        ASSIGN                                                   !2, ~23
    5    13        INIT_FCALL                                               'strpos'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 'GROUP+BY'
         16        DO_ICALL                                         $25     
         17        CAST                                          4  ~26     $25
         18        ASSIGN                                                   !3, ~26
    6    19        INIT_FCALL                                               'strpos'
         20        SEND_VAR                                                 !0
         21        SEND_VAL                                                 'ORDER+BY'
         22        DO_ICALL                                         $28     
         23        CAST                                          4  ~29     $28
         24        ASSIGN                                                   !4, ~29
    8    25        IS_SMALLER                                       ~31     0, !2
         26      > JMPZ_EX                                          ~31     ~31, ->29
         27    >   IS_SMALLER                                       ~32     !3, !2
         28        BOOL                                             ~31     ~32
         29    > > JMPZ_EX                                          ~31     ~31, ->32
         30    >   IS_SMALLER                                       ~33     !4, !2
         31        BOOL                                             ~31     ~33
         32    > > JMPZ                                                     ~31, ->40
    9    33    >   INIT_FCALL                                               'substr'
         34        SEND_VAR                                                 !0
         35        SEND_VAR                                                 !1
         36        SEND_VAR                                                 !2
         37        DO_ICALL                                         $34     
         38        ASSIGN                                                   !5, $34
         39      > JMP                                                      ->75
   10    40    >   IS_SMALLER                                       ~36     0, !3
         41      > JMPZ_EX                                          ~36     ~36, ->44
         42    >   IS_SMALLER                                       ~37     !2, !3
         43        BOOL                                             ~36     ~37
         44    > > JMPZ_EX                                          ~36     ~36, ->47
         45    >   IS_SMALLER                                       ~38     !4, !3
         46        BOOL                                             ~36     ~38
         47    > > JMPZ                                                     ~36, ->55
   11    48    >   INIT_FCALL                                               'substr'
         49        SEND_VAR                                                 !0
         50        SEND_VAR                                                 !1
         51        SEND_VAR                                                 !3
         52        DO_ICALL                                         $39     
         53        ASSIGN                                                   !5, $39
         54      > JMP                                                      ->75
   12    55    >   IS_SMALLER                                       ~41     0, !4
         56      > JMPZ_EX                                          ~41     ~41, ->59
         57    >   IS_SMALLER                                       ~42     !2, !4
         58        BOOL                                             ~41     ~42
         59    > > JMPZ_EX                                          ~41     ~41, ->62
         60    >   IS_SMALLER                                       ~43     !3, !4
         61        BOOL                                             ~41     ~43
         62    > > JMPZ                                                     ~41, ->70
   13    63    >   INIT_FCALL                                               'substr'
         64        SEND_VAR                                                 !0
         65        SEND_VAR                                                 !1
         66        SEND_VAR                                                 !4
         67        DO_ICALL                                         $44     
         68        ASSIGN                                                   !5, $44
         69      > JMP                                                      ->75
   15    70    >   INIT_FCALL                                               'substr'
         71        SEND_VAR                                                 !0
         72        SEND_VAR                                                 !1
         73        DO_ICALL                                         $46     
         74        ASSIGN                                                   !5, $46
   18    75    >   INIT_FCALL                                               'substr'
         76        SEND_VAR                                                 !0
         77        SEND_VAL                                                 0
         78        SEND_VAR                                                 !1
         79        DO_ICALL                                         $48     
         80        ASSIGN                                                   !6, $48
   19    81        ASSIGN                                                   !7, ''
   20    82        ASSIGN                                                   !8, <array>
   21    83        INIT_FCALL                                               'explode'
         84        SEND_VAL                                                 '+AND+'
         85        SEND_VAR                                                 !5
         86        DO_ICALL                                         $52     
         87        ASSIGN                                                   !9, $52
   22    88        COUNT                                            ~54     !9
         89        ASSIGN                                                   !10, ~54
   24    90        ASSIGN                                                   !11, 0
         91      > JMP                                                      ->179
   25    92    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~57     !9, !11
         93        BOOL_NOT                                         ~58     ~57
         94      > JMPZ                                                     ~58, ->96
   26    95    > > JMP                                                      ->178
   28    96    >   FETCH_DIM_R                                      ~59     !9, !11
         97        ASSIGN                                                   !12, ~59
   29    98        ADD                                              ~61     !11, 1
         99        ISSET_ISEMPTY_DIM_OBJ                         0  ~62     !9, ~61
        100      > JMPZ_EX                                          ~62     ~62, ->109
        101    >   INIT_FCALL                                               'preg_match'
        102        SEND_VAL                                                 '%2F%28%5B%5C%60a-z0-9%5C_%5C-%5D%2B%29%5B%5Cs%5D%7B0%2C1%7D%28%5C%3D%7CLIKE%7C%5C%3C%7C%5C%3E%7C%5C%3C%5C%3D%7C%5C%3E%5C%3D%7C%21%5C%3D%29%5B%5Cs%5D%7B0%2C1%7D%28.%2A%29%2Fi'
        103        ADD                                              ~63     !11, 1
        104        FETCH_DIM_R                                      ~64     !9, ~63
        105        SEND_VAL                                                 ~64
        106        DO_ICALL                                         $65     
        107        IS_NOT_EQUAL                                     ~66     $65, 1
        108        BOOL                                             ~62     ~66
        109    > > JMPZ                                                     ~62, ->121
   30   110    >   FETCH_DIM_R                                      ~68     !9, !11
        111        CONCAT                                           ~69     ~68, '+AND+'
        112        ADD                                              ~70     !11, 1
        113        FETCH_DIM_R                                      ~71     !9, ~70
        114        CONCAT                                           ~72     ~69, ~71
        115        ASSIGN_DIM                                               !9, !11
        116        OP_DATA                                                  ~72
   31   117        FETCH_DIM_R                                      ~73     !9, !11
        118        ASSIGN                                                   !12, ~73
   32   119        ADD                                              ~75     !11, 1
        120        UNSET_DIM                                                !9, ~75
   35   121    >   INIT_FCALL                                               'explode'
        122        SEND_VAL                                                 '+OR+'
        123        SEND_VAR                                                 !12
        124        DO_ICALL                                         $76     
        125        ASSIGN                                                   !13, $76
   36   126        COUNT                                            ~78     !13
        127        ASSIGN                                                   !14, ~78
   37   128        ASSIGN                                                   !15, 0
        129      > JMP                                                      ->168
   38   130    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~81     !13, !11
        131        BOOL_NOT                                         ~82     ~81
        132      > JMPZ                                                     ~82, ->134
   39   133    > > JMP                                                      ->167
   41   134    >   FETCH_DIM_R                                      ~83     !13, !15
        135        ASSIGN                                                   !16, ~83
   42   136        ADD                                              ~85     !15, 1
        137        ISSET_ISEMPTY_DIM_OBJ                         0  ~86     !13, ~85
        138      > JMPZ_EX                                          ~86     ~86, ->147
        139    >   INIT_FCALL                                               'preg_match'
        140        SEND_VAL                                                 '%2F%28%5B%5C%60a-z0-9%5C_%5C-%5D%2B%29%5B%5Cs%5D%7B0%2C1%7D%28%5C%3D%7CLIKE%7C%5C%3C%7C%5C%3E%7C%5C%3C%5C%3D%7C%5C%3E%5C%3D%7C%21%5C%3D%29%5B%5Cs%5D%7B0%2C1%7D%28.%2A%29%2Fi'
        141        ADD                                              ~87     !15, 1
        142        FETCH_DIM_R                                      ~88     !13, ~87
        143        SEND_VAL                                                 ~88
        144        DO_ICALL                                         $89     
        145        IS_NOT_EQUAL                                     ~90     $89, 1
        146        BOOL                                             ~86     ~90
        147    > > JMPZ                                                     ~86, ->159
   43   148    >   FETCH_DIM_R                                      ~92     !13, !15
        149        CONCAT                                           ~93     ~92, '+OR+'
        150        ADD                                              ~94     !15, 1
        151        FETCH_DIM_R                                      ~95     !13, ~94
        152        CONCAT                                           ~96     ~93, ~95
        153        ASSIGN_DIM                                               !13, !15
        154        OP_DATA                                                  ~96
   44   155        FETCH_DIM_R                                      ~97     !13, !15
        156        ASSIGN                                                   !16, ~97
   45   157        ADD                                              ~99     !15, 1
        158        UNSET_DIM                                                !13, ~99
   48   159    >   INIT_FCALL                                               'preg_match'
        160        SEND_VAL                                                 '%2F%28%5B%5C%60a-z0-9%5C_%5C-%5D%2B%29%5B%5Cs%5D%7B0%2C1%7D%28%5C%3D%7CLIKE%7C%5C%3C%7C%5C%3E%7C%5C%3C%5C%3D%7C%5C%3E%5C%3D%7C%21%5C%3D%29%5B%5Cs%5D%7B0%2C1%7D%28.%2A%29%2Fi'
        161        SEND_VAR                                                 !16
        162        SEND_REF                                                 !17
        163        DO_ICALL                                                 
   49   164        INIT_FCALL                                               'var_dump'
        165        SEND_VAR                                                 !17
        166        DO_ICALL                                                 
   37   167    >   PRE_INC                                                  !15
        168    >   IS_SMALLER                                               !15, !14
        169      > JMPNZ                                                    ~103, ->130
   52   170    >   INIT_FCALL                                               'preg_match'
        171        SEND_VAL                                                 '%2F%28%5B%5C%60a-z0-9%5C_%5C-%5D%2B%29%5B%5Cs%5D%7B0%2C1%7D%28%5C%3D%7CLIKE%7C%5C%3C%7C%5C%3E%7C%5C%3C%5C%3D%7C%5C%3E%5C%3D%7C%21%5C%3D%29%5B%5Cs%5D%7B0%2C1%7D%28.%2A%29%2Fi'
        172        SEND_VAR                                                 !12
        173        SEND_REF                                                 !17
        174        DO_ICALL                                                 
   53   175        INIT_FCALL                                               'var_dump'
        176        SEND_VAR                                                 !17
        177        DO_ICALL                                                 
   24   178    >   PRE_INC                                                  !11
        179    >   IS_SMALLER                                               !11, !10
        180      > JMPNZ                                                    ~107, ->92
   54   181    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.72 ms | 1412 KiB | 23 Q