3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "categoryEnglishName:shouji dangers:(newuuid deep1条 IpCrossRule MobileCrossAreaRule) dangers:(FirstTimeImageRule OR DifferentIpmobledress) brid:(881581631eadc6e649b7dcb091a59396 OR 6dde9f581f114e2737bc56719990ec7a)"; 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]; $qq = preg_match('/[ OR | AND ]+/') ? $m[2][$i] : str_replace(" ", " AND ", $m[2][$i]); $qq = str_replace(array(" OR ", " AND "), array(" OR {$key}:", " AND {$key}:"), $qq); $str = str_replace($q, "({$key}:" . $qq. ")", $str); } } var_dump($str);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 69
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 9
Branch analysis from position: 69
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 = 64
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 9
Branch analysis from position: 69
Branch analysis from position: 9
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 30
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 9
Branch analysis from position: 69
Branch analysis from position: 9
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 9
Branch analysis from position: 69
Branch analysis from position: 9
Branch analysis from position: 69
filename:       /in/DkQYp
function name:  (null)
number of ops:  73
compiled vars:  !0 = $str, !1 = $m, !2 = $i, !3 = $q, !4 = $key, !5 = $qq
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'categoryEnglishName%3Ashouji+dangers%3A%28newuuid+deep1%E6%9D%A1+IpCrossRule+MobileCrossAreaRule%29+dangers%3A%28FirstTimeImageRule+OR+DifferentIpmobledress%29+brid%3A%28881581631eadc6e649b7dcb091a59396+OR+6dde9f581f114e2737bc56719990ec7a%29'
    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                                         $7      
          6      > JMPZ                                                     $7, ->69
    5     7    >   ASSIGN                                                   !2, 0
          8      > JMP                                                      ->65
    6     9    >   INIT_FCALL                                               'trim'
         10        FETCH_DIM_R                                      ~9      !1, 0
         11        FETCH_DIM_R                                      ~10     ~9, !2
         12        SEND_VAL                                                 ~10
         13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !3, $11
    7    15        STRLEN                                           ~13     !3
         16        IS_EQUAL                                                 ~13, 0
         17      > JMPZ                                                     ~14, ->19
         18    > > JMP                                                      ->64
    8    19    >   FETCH_DIM_R                                      ~15     !1, 1
         20        FETCH_DIM_R                                      ~16     ~15, !2
         21        ASSIGN                                                   !4, ~16
    9    22        INIT_FCALL                                               'preg_match'
         23        SEND_VAL                                                 '%2F%5B+OR+%7C+AND+%5D%2B%2F'
         24        DO_ICALL                                         $18     
         25      > JMPZ                                                     $18, ->30
         26    >   FETCH_DIM_R                                      ~19     !1, 2
         27        FETCH_DIM_R                                      ~20     ~19, !2
         28        QM_ASSIGN                                        ~21     ~20
         29      > JMP                                                      ->38
         30    >   INIT_FCALL                                               'str_replace'
         31        SEND_VAL                                                 '+'
         32        SEND_VAL                                                 '+AND+'
         33        FETCH_DIM_R                                      ~22     !1, 2
         34        FETCH_DIM_R                                      ~23     ~22, !2
         35        SEND_VAL                                                 ~23
         36        DO_ICALL                                         $24     
         37        QM_ASSIGN                                        ~21     $24
         38    >   ASSIGN                                                   !5, ~21
   10    39        INIT_FCALL                                               'str_replace'
         40        SEND_VAL                                                 <array>
         41        ROPE_INIT                                     3  ~27     '+OR+'
         42        ROPE_ADD                                      1  ~27     ~27, !4
         43        ROPE_END                                      2  ~26     ~27, '%3A'
         44        INIT_ARRAY                                       ~29     ~26
         45        ROPE_INIT                                     3  ~31     '+AND+'
         46        ROPE_ADD                                      1  ~31     ~31, !4
         47        ROPE_END                                      2  ~30     ~31, '%3A'
         48        ADD_ARRAY_ELEMENT                                ~29     ~30
         49        SEND_VAL                                                 ~29
         50        SEND_VAR                                                 !5
         51        DO_ICALL                                         $33     
         52        ASSIGN                                                   !5, $33
   12    53        INIT_FCALL                                               'str_replace'
         54        SEND_VAR                                                 !3
         55        ROPE_INIT                                     3  ~36     '%28'
         56        ROPE_ADD                                      1  ~36     ~36, !4
         57        ROPE_END                                      2  ~35     ~36, '%3A'
         58        CONCAT                                           ~38     ~35, !5
         59        CONCAT                                           ~39     ~38, '%29'
         60        SEND_VAL                                                 ~39
         61        SEND_VAR                                                 !0
         62        DO_ICALL                                         $40     
         63        ASSIGN                                                   !0, $40
    5    64    >   PRE_INC                                                  !2
         65    >   FETCH_DIM_R                                      ~43     !1, 0
         66        COUNT                                            ~44     ~43
         67        IS_SMALLER                                               !2, ~44
         68      > JMPNZ                                                    ~45, ->9
   16    69    >   INIT_FCALL                                               'var_dump'
         70        SEND_VAR                                                 !0
         71        DO_ICALL                                                 
         72      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.88 ms | 1400 KiB | 23 Q