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]) ? $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 = 72
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
2 jumps found. (Code = 44) Position 1 = 72, Position 2 = 9
Branch analysis from position: 72
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 = 67
Branch analysis from position: 67
2 jumps found. (Code = 44) Position 1 = 72, Position 2 = 9
Branch analysis from position: 72
Branch analysis from position: 9
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 33
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 72, Position 2 = 9
Branch analysis from position: 72
Branch analysis from position: 9
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 72, Position 2 = 9
Branch analysis from position: 72
Branch analysis from position: 9
Branch analysis from position: 72
filename:       /in/MFnL4
function name:  (null)
number of ops:  76
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, ->72
    5     7    >   ASSIGN                                                   !2, 0
          8      > JMP                                                      ->68
    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                                                      ->67
    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%28+OR+%7C+AND+%29%2B%2F'
         24        FETCH_DIM_R                                      ~18     !1, 2
         25        FETCH_DIM_R                                      ~19     ~18, !2
         26        SEND_VAL                                                 ~19
         27        DO_ICALL                                         $20     
         28      > JMPZ                                                     $20, ->33
         29    >   FETCH_DIM_R                                      ~21     !1, 2
         30        FETCH_DIM_R                                      ~22     ~21, !2
         31        QM_ASSIGN                                        ~23     ~22
         32      > JMP                                                      ->41
         33    >   INIT_FCALL                                               'str_replace'
         34        SEND_VAL                                                 '+'
         35        SEND_VAL                                                 '+AND+'
         36        FETCH_DIM_R                                      ~24     !1, 2
         37        FETCH_DIM_R                                      ~25     ~24, !2
         38        SEND_VAL                                                 ~25
         39        DO_ICALL                                         $26     
         40        QM_ASSIGN                                        ~23     $26
         41    >   ASSIGN                                                   !5, ~23
   10    42        INIT_FCALL                                               'str_replace'
         43        SEND_VAL                                                 <array>
         44        ROPE_INIT                                     3  ~29     '+OR+'
         45        ROPE_ADD                                      1  ~29     ~29, !4
         46        ROPE_END                                      2  ~28     ~29, '%3A'
         47        INIT_ARRAY                                       ~31     ~28
         48        ROPE_INIT                                     3  ~33     '+AND+'
         49        ROPE_ADD                                      1  ~33     ~33, !4
         50        ROPE_END                                      2  ~32     ~33, '%3A'
         51        ADD_ARRAY_ELEMENT                                ~31     ~32
         52        SEND_VAL                                                 ~31
         53        SEND_VAR                                                 !5
         54        DO_ICALL                                         $35     
         55        ASSIGN                                                   !5, $35
   12    56        INIT_FCALL                                               'str_replace'
         57        SEND_VAR                                                 !3
         58        ROPE_INIT                                     3  ~38     '%28'
         59        ROPE_ADD                                      1  ~38     ~38, !4
         60        ROPE_END                                      2  ~37     ~38, '%3A'
         61        CONCAT                                           ~40     ~37, !5
         62        CONCAT                                           ~41     ~40, '%29'
         63        SEND_VAL                                                 ~41
         64        SEND_VAR                                                 !0
         65        DO_ICALL                                         $42     
         66        ASSIGN                                                   !0, $42
    5    67    >   PRE_INC                                                  !2
         68    >   FETCH_DIM_R                                      ~45     !1, 0
         69        COUNT                                            ~46     ~45
         70        IS_SMALLER                                               !2, ~46
         71      > JMPNZ                                                    ~47, ->9
   16    72    >   INIT_FCALL                                               'var_dump'
         73        SEND_VAR                                                 !0
         74        DO_ICALL                                                 
         75      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.25 ms | 1400 KiB | 23 Q