3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "(联想 OR 戴尔 OR 苹果 OR 宏基) dangers:(newuuid deep1条 FirstTimeImageRule) 价格_i:[1500 TO 2500] cityEnglishName:beijing categoryEnglishName:bijiben"; if (preg_match_all('/([a-zA-Z]+)\:\(([^\)]+)\)/', $str, $m)) { for ($i = 0; $i < count($m[0]); $i++) { $q = trim($m[0][$i]); if (strlen($q) == 0) continue; $key = $m[1][$i]; $op = strpos($q, ' OR ') ? ' OR ' : ' AND '; $qq = str_replace(array(" OR ", " AND ", " "), array(" OR {$key}:", " AND {$key}:", " {$key}:"), $m[2][$i]); $str = str_replace($q, "(" . $qq. ")", $str); } } var_dump($str);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 64
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 9
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 9
Branch analysis from position: 64
Branch analysis from position: 9
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 9
Branch analysis from position: 64
Branch analysis from position: 9
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 9
Branch analysis from position: 64
Branch analysis from position: 9
Branch analysis from position: 64
filename:       /in/5vRWU
function name:  (null)
number of ops:  68
compiled vars:  !0 = $str, !1 = $m, !2 = $i, !3 = $q, !4 = $key, !5 = $op, !6 = $qq
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%28%E8%81%94%E6%83%B3+OR+%E6%88%B4%E5%B0%94+OR+%E8%8B%B9%E6%9E%9C+OR+%E5%AE%8F%E5%9F%BA%29+dangers%3A%28newuuid+deep1%E6%9D%A1+FirstTimeImageRule%29+%E4%BB%B7%E6%A0%BC_i%3A%5B1500+TO+2500%5D+cityEnglishName%3Abeijing+categoryEnglishName%3Abijiben'
    4     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%28%5Ba-zA-Z%5D%2B%29%5C%3A%5C%28%28%5B%5E%5C%29%5D%2B%29%5C%29%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                         $8      
          6      > JMPZ                                                     $8, ->64
    5     7    >   ASSIGN                                                   !2, 0
          8      > JMP                                                      ->60
    6     9    >   INIT_FCALL                                               'trim'
         10        FETCH_DIM_R                                      ~10     !1, 0
         11        FETCH_DIM_R                                      ~11     ~10, !2
         12        SEND_VAL                                                 ~11
         13        DO_ICALL                                         $12     
         14        ASSIGN                                                   !3, $12
    7    15        STRLEN                                           ~14     !3
         16        IS_EQUAL                                                 ~14, 0
         17      > JMPZ                                                     ~15, ->19
         18    > > JMP                                                      ->59
    8    19    >   FETCH_DIM_R                                      ~16     !1, 1
         20        FETCH_DIM_R                                      ~17     ~16, !2
         21        ASSIGN                                                   !4, ~17
    9    22        INIT_FCALL                                               'strpos'
         23        SEND_VAR                                                 !3
         24        SEND_VAL                                                 '+OR+'
         25        DO_ICALL                                         $19     
         26      > JMPZ                                                     $19, ->29
         27    >   QM_ASSIGN                                        ~20     '+OR+'
         28      > JMP                                                      ->30
         29    >   QM_ASSIGN                                        ~20     '+AND+'
         30    >   ASSIGN                                                   !5, ~20
   10    31        INIT_FCALL                                               'str_replace'
         32        SEND_VAL                                                 <array>
         33        ROPE_INIT                                     3  ~23     '+OR+'
         34        ROPE_ADD                                      1  ~23     ~23, !4
         35        ROPE_END                                      2  ~22     ~23, '%3A'
         36        INIT_ARRAY                                       ~25     ~22
         37        ROPE_INIT                                     3  ~27     '+AND+'
         38        ROPE_ADD                                      1  ~27     ~27, !4
         39        ROPE_END                                      2  ~26     ~27, '%3A'
         40        ADD_ARRAY_ELEMENT                                ~25     ~26
         41        ROPE_INIT                                     3  ~30     '+'
         42        ROPE_ADD                                      1  ~30     ~30, !4
         43        ROPE_END                                      2  ~29     ~30, '%3A'
         44        ADD_ARRAY_ELEMENT                                ~25     ~29
         45        SEND_VAL                                                 ~25
         46        FETCH_DIM_R                                      ~32     !1, 2
         47        FETCH_DIM_R                                      ~33     ~32, !2
         48        SEND_VAL                                                 ~33
         49        DO_ICALL                                         $34     
         50        ASSIGN                                                   !6, $34
   12    51        INIT_FCALL                                               'str_replace'
         52        SEND_VAR                                                 !3
         53        CONCAT                                           ~36     '%28', !6
         54        CONCAT                                           ~37     ~36, '%29'
         55        SEND_VAL                                                 ~37
         56        SEND_VAR                                                 !0
         57        DO_ICALL                                         $38     
         58        ASSIGN                                                   !0, $38
    5    59    >   PRE_INC                                                  !2
         60    >   FETCH_DIM_R                                      ~41     !1, 0
         61        COUNT                                            ~42     ~41
         62        IS_SMALLER                                               !2, ~42
         63      > JMPNZ                                                    ~43, ->9
   16    64    >   INIT_FCALL                                               'var_dump'
         65        SEND_VAR                                                 !0
         66        DO_ICALL                                                 
         67      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.89 ms | 1400 KiB | 23 Q