3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "ayy lmao tag: anal, dick pornstar: James Deen channel:x-Art" . " end:"; $pattern = "/.+?(?=(tag|pornstar|channel|end)+:)/"; preg_match_all($pattern, $string, $matches); $meme = array(); $final = array(); for($i = 0; $i < sizeof($matches[0]); $i++) { $meme[$i] = explode(":", $matches[0][$i]); } $sql = "SELECT "; for($i = 0; $i < sizeof($meme); $i++) { if(sizeof($meme[$i]) == 1) { $sql .= "`videos`.`name`"; } else { $sql .= "`" . $meme[$i][0] . "s`.`name`"; } if($i != sizeof($meme)-1) { $sql .= ", "; } } $sql .= "\nFROM `videos`\n"; for($i = 0; $i < sizeof($meme); $i++) { if(sizeof($meme[$i]) == 2) { $sql .= "LEFT JOIN `video_" . $meme[$i][0] . "s` ON `video_" . $meme[$i][0] . "s`.`video` = `videos`.`id`\n"; $sql .= "LEFT JOIN `" . $meme[$i][0] . "s` ON `" . $meme[$i][0] . "s`.`id` = `video_`" . $meme[$i][0] . "s`.`" . $meme[$i][0] . "`\n"; } } $sql .= "\nWHERE\n"; for($i = 0; $i < sizeof($meme); $i++) { if(sizeof($meme[$i]) == 1) { $sql .= "`videos`.`name` LIKE '% " . $meme[$i][1] . "%'\n"; } else { $sql .= "`" . $meme[$i][0] . "`.`name` LIKE '%" . $meme[$i][1] . "%'\n"; } if($i != sizeof($meme)-1) { $sql .= "\nAND\n"; } } print_r($matches); print_r($meme); print_r($sql); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 11
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 27
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 81
Branch analysis from position: 81
2 jumps found. (Code = 44) Position 1 = 84, Position 2 = 50
Branch analysis from position: 84
1 jumps found. (Code = 42) Position 1 = 112
Branch analysis from position: 112
2 jumps found. (Code = 44) Position 1 = 115, Position 2 = 87
Branch analysis from position: 115
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 87
2 jumps found. (Code = 43) Position 1 = 91, Position 2 = 97
Branch analysis from position: 91
1 jumps found. (Code = 42) Position 1 = 106
Branch analysis from position: 106
2 jumps found. (Code = 43) Position 1 = 110, Position 2 = 111
Branch analysis from position: 110
2 jumps found. (Code = 44) Position 1 = 115, Position 2 = 87
Branch analysis from position: 115
Branch analysis from position: 87
Branch analysis from position: 111
Branch analysis from position: 97
2 jumps found. (Code = 43) Position 1 = 110, Position 2 = 111
Branch analysis from position: 110
Branch analysis from position: 111
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 80
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 84, Position 2 = 50
Branch analysis from position: 84
Branch analysis from position: 50
Branch analysis from position: 80
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 38
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 = 27
Branch analysis from position: 47
Branch analysis from position: 27
Branch analysis from position: 43
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 43
Branch analysis from position: 42
Branch analysis from position: 43
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 11
Branch analysis from position: 24
Branch analysis from position: 11
filename:       /in/RBCaF
function name:  (null)
number of ops:  125
compiled vars:  !0 = $string, !1 = $pattern, !2 = $matches, !3 = $meme, !4 = $final, !5 = $i, !6 = $sql
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'ayy+lmao+tag%3A+anal%2C+dick+pornstar%3A+James+Deen+channel%3Ax-Art+end%3A'
    5     1        ASSIGN                                                   !1, '%2F.%2B%3F%28%3F%3D%28tag%7Cpornstar%7Cchannel%7Cend%29%2B%3A%29%2F'
    7     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    9     7        ASSIGN                                                   !3, <array>
   10     8        ASSIGN                                                   !4, <array>
   11     9        ASSIGN                                                   !5, 0
         10      > JMP                                                      ->20
   12    11    >   INIT_FCALL                                               'explode'
         12        SEND_VAL                                                 '%3A'
         13        FETCH_DIM_R                                      ~14     !2, 0
         14        FETCH_DIM_R                                      ~15     ~14, !5
         15        SEND_VAL                                                 ~15
         16        DO_ICALL                                         $16     
         17        ASSIGN_DIM                                               !3, !5
         18        OP_DATA                                                  $16
   11    19        PRE_INC                                                  !5
         20    >   FETCH_DIM_R                                      ~18     !2, 0
         21        COUNT                                            ~19     ~18
         22        IS_SMALLER                                               !5, ~19
         23      > JMPNZ                                                    ~20, ->11
   14    24    >   ASSIGN                                                   !6, 'SELECT+'
   16    25        ASSIGN                                                   !5, 0
         26      > JMP                                                      ->44
   17    27    >   FETCH_DIM_R                                      ~23     !3, !5
         28        COUNT                                            ~24     ~23
         29        IS_EQUAL                                                 ~24, 1
         30      > JMPZ                                                     ~25, ->33
   18    31    >   ASSIGN_OP                                     8          !6, '%60videos%60.%60name%60'
         32      > JMP                                                      ->38
   20    33    >   FETCH_DIM_R                                      ~27     !3, !5
         34        FETCH_DIM_R                                      ~28     ~27, 0
         35        CONCAT                                           ~29     '%60', ~28
         36        CONCAT                                           ~30     ~29, 's%60.%60name%60'
         37        ASSIGN_OP                                     8          !6, ~30
   23    38    >   COUNT                                            ~32     !3
         39        SUB                                              ~33     ~32, 1
         40        IS_NOT_EQUAL                                             !5, ~33
         41      > JMPZ                                                     ~34, ->43
   24    42    >   ASSIGN_OP                                     8          !6, '%2C+'
   16    43    >   PRE_INC                                                  !5
         44    >   COUNT                                            ~37     !3
         45        IS_SMALLER                                               !5, ~37
         46      > JMPNZ                                                    ~38, ->27
   28    47    >   ASSIGN_OP                                     8          !6, '%0AFROM+%60videos%60%0A'
   30    48        ASSIGN                                                   !5, 0
         49      > JMP                                                      ->81
   31    50    >   FETCH_DIM_R                                      ~41     !3, !5
         51        COUNT                                            ~42     ~41
         52        IS_EQUAL                                                 ~42, 2
         53      > JMPZ                                                     ~43, ->80
   32    54    >   FETCH_DIM_R                                      ~44     !3, !5
         55        FETCH_DIM_R                                      ~45     ~44, 0
         56        CONCAT                                           ~46     'LEFT+JOIN+%60video_', ~45
         57        CONCAT                                           ~47     ~46, 's%60+ON+%60video_'
         58        FETCH_DIM_R                                      ~48     !3, !5
         59        FETCH_DIM_R                                      ~49     ~48, 0
         60        CONCAT                                           ~50     ~47, ~49
         61        CONCAT                                           ~51     ~50, 's%60.%60video%60+%3D+%60videos%60.%60id%60%0A'
         62        ASSIGN_OP                                     8          !6, ~51
   33    63        FETCH_DIM_R                                      ~53     !3, !5
         64        FETCH_DIM_R                                      ~54     ~53, 0
         65        CONCAT                                           ~55     'LEFT+JOIN+%60', ~54
         66        CONCAT                                           ~56     ~55, 's%60+ON+%60'
         67        FETCH_DIM_R                                      ~57     !3, !5
         68        FETCH_DIM_R                                      ~58     ~57, 0
         69        CONCAT                                           ~59     ~56, ~58
         70        CONCAT                                           ~60     ~59, 's%60.%60id%60+%3D+%60video_%60'
         71        FETCH_DIM_R                                      ~61     !3, !5
         72        FETCH_DIM_R                                      ~62     ~61, 0
         73        CONCAT                                           ~63     ~60, ~62
         74        CONCAT                                           ~64     ~63, 's%60.%60'
         75        FETCH_DIM_R                                      ~65     !3, !5
         76        FETCH_DIM_R                                      ~66     ~65, 0
         77        CONCAT                                           ~67     ~64, ~66
         78        CONCAT                                           ~68     ~67, '%60%0A'
         79        ASSIGN_OP                                     8          !6, ~68
   30    80    >   PRE_INC                                                  !5
         81    >   COUNT                                            ~71     !3
         82        IS_SMALLER                                               !5, ~71
         83      > JMPNZ                                                    ~72, ->50
   37    84    >   ASSIGN_OP                                     8          !6, '%0AWHERE%0A'
   39    85        ASSIGN                                                   !5, 0
         86      > JMP                                                      ->112
   40    87    >   FETCH_DIM_R                                      ~75     !3, !5
         88        COUNT                                            ~76     ~75
         89        IS_EQUAL                                                 ~76, 1
         90      > JMPZ                                                     ~77, ->97
   41    91    >   FETCH_DIM_R                                      ~78     !3, !5
         92        FETCH_DIM_R                                      ~79     ~78, 1
         93        CONCAT                                           ~80     '%60videos%60.%60name%60+LIKE+%27%25+', ~79
         94        CONCAT                                           ~81     ~80, '%25%27%0A'
         95        ASSIGN_OP                                     8          !6, ~81
         96      > JMP                                                      ->106
   43    97    >   FETCH_DIM_R                                      ~83     !3, !5
         98        FETCH_DIM_R                                      ~84     ~83, 0
         99        CONCAT                                           ~85     '%60', ~84
        100        CONCAT                                           ~86     ~85, '%60.%60name%60+LIKE+%27%25'
        101        FETCH_DIM_R                                      ~87     !3, !5
        102        FETCH_DIM_R                                      ~88     ~87, 1
        103        CONCAT                                           ~89     ~86, ~88
        104        CONCAT                                           ~90     ~89, '%25%27%0A'
        105        ASSIGN_OP                                     8          !6, ~90
   46   106    >   COUNT                                            ~92     !3
        107        SUB                                              ~93     ~92, 1
        108        IS_NOT_EQUAL                                             !5, ~93
        109      > JMPZ                                                     ~94, ->111
   47   110    >   ASSIGN_OP                                     8          !6, '%0AAND%0A'
   39   111    >   PRE_INC                                                  !5
        112    >   COUNT                                            ~97     !3
        113        IS_SMALLER                                               !5, ~97
        114      > JMPNZ                                                    ~98, ->87
   51   115    >   INIT_FCALL                                               'print_r'
        116        SEND_VAR                                                 !2
        117        DO_ICALL                                                 
   52   118        INIT_FCALL                                               'print_r'
        119        SEND_VAR                                                 !3
        120        DO_ICALL                                                 
   53   121        INIT_FCALL                                               'print_r'
        122        SEND_VAR                                                 !6
        123        DO_ICALL                                                 
   54   124      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.07 ms | 1408 KiB | 19 Q