3v4l.org

run code in 300+ PHP versions simultaneously
<?php $num = '7778855'; $mask = 'aabb'; $pattern = '/()?'; $arr = array(''); for($i=0;$i<strlen($mask);$i++) if(in_array($mask[$i] , $arr)) $pattern .= '\\'.array_search($mask[$i] , $arr); else {$pattern .= '([^\g{-1}])';$arr[] = $mask[$i];} $pattern .= '/'; var_dump($pattern); var_dump(preg_replace($pattern, '<$0>', $num));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 6
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 6
Branch analysis from position: 28
Branch analysis from position: 6
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 6
Branch analysis from position: 28
Branch analysis from position: 6
filename:       /in/frSgc
function name:  (null)
number of ops:  41
compiled vars:  !0 = $num, !1 = $mask, !2 = $pattern, !3 = $arr, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '7778855'
    3     1        ASSIGN                                                   !1, 'aabb'
    4     2        ASSIGN                                                   !2, '%2F%28%29%3F'
    5     3        ASSIGN                                                   !3, <array>
    6     4        ASSIGN                                                   !4, 0
          5      > JMP                                                      ->25
    7     6    >   INIT_FCALL                                               'in_array'
          7        FETCH_DIM_R                                      ~10     !1, !4
          8        SEND_VAL                                                 ~10
          9        SEND_VAR                                                 !3
         10        DO_ICALL                                         $11     
         11      > JMPZ                                                     $11, ->20
         12    >   INIT_FCALL                                               'array_search'
         13        FETCH_DIM_R                                      ~12     !1, !4
         14        SEND_VAL                                                 ~12
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $13     
         17        CONCAT                                           ~14     '%5C', $13
         18        ASSIGN_OP                                     8          !2, ~14
         19      > JMP                                                      ->24
    8    20    >   ASSIGN_OP                                     8          !2, '%28%5B%5E%5Cg%7B-1%7D%5D%29'
         21        FETCH_DIM_R                                      ~18     !1, !4
         22        ASSIGN_DIM                                               !3
         23        OP_DATA                                                  ~18
    6    24    >   PRE_INC                                                  !4
         25    >   STRLEN                                           ~20     !1
         26        IS_SMALLER                                               !4, ~20
         27      > JMPNZ                                                    ~21, ->6
    9    28    >   ASSIGN_OP                                     8          !2, '%2F'
   10    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !2
         31        DO_ICALL                                                 
   11    32        INIT_FCALL                                               'var_dump'
         33        INIT_FCALL                                               'preg_replace'
         34        SEND_VAR                                                 !2
         35        SEND_VAL                                                 '%3C%240%3E'
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $24     
         38        SEND_VAR                                                 $24
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.49 ms | 1400 KiB | 21 Q