3v4l.org

run code in 300+ PHP versions simultaneously
<?php $newString = "he 800s."; $originalString = $newString; $regex = "/[$#]*(\d+(\.|\,|\s)?\d*(\.|\,|\s)?\d*){3,}[%.\)]*/"; preg_match_all($regex, $originalString, $matches); foreach($matches[0] as $match) { if ($match[0] == "$" || $match[0] == "#") { continue; } $stringLength = strlen($match); if ($match[$stringLength - 1] == "%" || $match[$stringLength - 1] == "." || $match[$stringLength - 1] == ")") { continue; } $replacement = ''; for ($i = 0; $i < strlen($match); $i++) { if ($match[$i] == '-' || $match[$i] == '+' || $match[$i] == ' ' || $match[$i] == '.' || $match[$i] == ',' || $match[$i] == '(' || $match[$i] == ')') { $replacement .= $match[$i]; } else { $replacement .= 'X'; } } $match = preg_quote($match); $newString = preg_replace("/" . $match . "/U", $replacement, $newString); } print_r("ORIGINAL STRING: " . $originalString . "\n"); print_r("FILTERED STRING: " . $newString . "\n"); print_r("MATCHES: \n"); print_r($matches);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 87
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 87
Branch analysis from position: 11
2 jumps found. (Code = 47) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 19
2 jumps found. (Code = 47) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
2 jumps found. (Code = 47) Position 1 = 30, Position 2 = 34
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 36
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
2 jumps found. (Code = 44) Position 1 = 74, Position 2 = 39
Branch analysis from position: 74
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 39
2 jumps found. (Code = 47) Position 1 = 42, Position 2 = 45
Branch analysis from position: 42
2 jumps found. (Code = 47) Position 1 = 46, Position 2 = 49
Branch analysis from position: 46
2 jumps found. (Code = 47) Position 1 = 50, Position 2 = 53
Branch analysis from position: 50
2 jumps found. (Code = 47) Position 1 = 54, Position 2 = 57
Branch analysis from position: 54
2 jumps found. (Code = 47) Position 1 = 58, Position 2 = 61
Branch analysis from position: 58
2 jumps found. (Code = 47) Position 1 = 62, Position 2 = 65
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 69
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
2 jumps found. (Code = 44) Position 1 = 74, Position 2 = 39
Branch analysis from position: 74
Branch analysis from position: 39
Branch analysis from position: 69
2 jumps found. (Code = 44) Position 1 = 74, Position 2 = 39
Branch analysis from position: 74
Branch analysis from position: 39
Branch analysis from position: 65
Branch analysis from position: 61
Branch analysis from position: 57
Branch analysis from position: 53
Branch analysis from position: 49
Branch analysis from position: 45
Branch analysis from position: 34
Branch analysis from position: 29
Branch analysis from position: 17
Branch analysis from position: 87
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 87
filename:       /in/SkqTf
function name:  (null)
number of ops:  105
compiled vars:  !0 = $newString, !1 = $originalString, !2 = $regex, !3 = $matches, !4 = $match, !5 = $stringLength, !6 = $replacement, !7 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'he+800s.'
    4     1        ASSIGN                                                   !1, !0
    5     2        ASSIGN                                                   !2, '%2F%5B%24%23%5D%2A%28%5Cd%2B%28%5C.%7C%5C%2C%7C%5Cs%29%3F%5Cd%2A%28%5C.%7C%5C%2C%7C%5Cs%29%3F%5Cd%2A%29%7B3%2C%7D%5B%25.%5C%29%5D%2A%2F'
    6     3        INIT_FCALL                                               'preg_match_all'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !1
          6        SEND_REF                                                 !3
          7        DO_ICALL                                                 
    7     8        FETCH_DIM_R                                      ~12     !3, 0
          9      > FE_RESET_R                                       $13     ~12, ->87
         10    > > FE_FETCH_R                                               $13, !4, ->87
    8    11    >   FETCH_DIM_R                                      ~14     !4, 0
         12        IS_EQUAL                                         ~15     ~14, '%24'
         13      > JMPNZ_EX                                         ~15     ~15, ->17
         14    >   FETCH_DIM_R                                      ~16     !4, 0
         15        IS_EQUAL                                         ~17     ~16, '%23'
         16        BOOL                                             ~15     ~17
         17    > > JMPZ                                                     ~15, ->19
    9    18    > > JMP                                                      ->10
   11    19    >   STRLEN                                           ~18     !4
         20        ASSIGN                                                   !5, ~18
   12    21        SUB                                              ~20     !5, 1
         22        FETCH_DIM_R                                      ~21     !4, ~20
         23        IS_EQUAL                                         ~22     ~21, '%25'
         24      > JMPNZ_EX                                         ~22     ~22, ->29
         25    >   SUB                                              ~23     !5, 1
         26        FETCH_DIM_R                                      ~24     !4, ~23
         27        IS_EQUAL                                         ~25     ~24, '.'
         28        BOOL                                             ~22     ~25
         29    > > JMPNZ_EX                                         ~22     ~22, ->34
         30    >   SUB                                              ~26     !5, 1
         31        FETCH_DIM_R                                      ~27     !4, ~26
         32        IS_EQUAL                                         ~28     ~27, '%29'
         33        BOOL                                             ~22     ~28
         34    > > JMPZ                                                     ~22, ->36
   13    35    > > JMP                                                      ->10
   15    36    >   ASSIGN                                                   !6, ''
   16    37        ASSIGN                                                   !7, 0
         38      > JMP                                                      ->71
   17    39    >   FETCH_DIM_R                                      ~31     !4, !7
         40        IS_EQUAL                                         ~32     ~31, '-'
         41      > JMPNZ_EX                                         ~32     ~32, ->45
         42    >   FETCH_DIM_R                                      ~33     !4, !7
         43        IS_EQUAL                                         ~34     ~33, '%2B'
         44        BOOL                                             ~32     ~34
         45    > > JMPNZ_EX                                         ~32     ~32, ->49
         46    >   FETCH_DIM_R                                      ~35     !4, !7
         47        IS_EQUAL                                         ~36     ~35, '+'
         48        BOOL                                             ~32     ~36
         49    > > JMPNZ_EX                                         ~32     ~32, ->53
         50    >   FETCH_DIM_R                                      ~37     !4, !7
         51        IS_EQUAL                                         ~38     ~37, '.'
         52        BOOL                                             ~32     ~38
         53    > > JMPNZ_EX                                         ~32     ~32, ->57
         54    >   FETCH_DIM_R                                      ~39     !4, !7
         55        IS_EQUAL                                         ~40     ~39, '%2C'
         56        BOOL                                             ~32     ~40
         57    > > JMPNZ_EX                                         ~32     ~32, ->61
         58    >   FETCH_DIM_R                                      ~41     !4, !7
         59        IS_EQUAL                                         ~42     ~41, '%28'
         60        BOOL                                             ~32     ~42
         61    > > JMPNZ_EX                                         ~32     ~32, ->65
         62    >   FETCH_DIM_R                                      ~43     !4, !7
         63        IS_EQUAL                                         ~44     ~43, '%29'
         64        BOOL                                             ~32     ~44
         65    > > JMPZ                                                     ~32, ->69
   18    66    >   FETCH_DIM_R                                      ~45     !4, !7
         67        ASSIGN_OP                                     8          !6, ~45
         68      > JMP                                                      ->70
   20    69    >   ASSIGN_OP                                     8          !6, 'X'
   16    70    >   PRE_INC                                                  !7
         71    >   STRLEN                                           ~49     !4
         72        IS_SMALLER                                               !7, ~49
         73      > JMPNZ                                                    ~50, ->39
   24    74    >   INIT_FCALL                                               'preg_quote'
         75        SEND_VAR                                                 !4
         76        DO_ICALL                                         $51     
         77        ASSIGN                                                   !4, $51
   25    78        INIT_FCALL                                               'preg_replace'
         79        CONCAT                                           ~53     '%2F', !4
         80        CONCAT                                           ~54     ~53, '%2FU'
         81        SEND_VAL                                                 ~54
         82        SEND_VAR                                                 !6
         83        SEND_VAR                                                 !0
         84        DO_ICALL                                         $55     
         85        ASSIGN                                                   !0, $55
    7    86      > JMP                                                      ->10
         87    >   FE_FREE                                                  $13
   28    88        INIT_FCALL                                               'print_r'
         89        CONCAT                                           ~57     'ORIGINAL+STRING%3A+', !1
         90        CONCAT                                           ~58     ~57, '%0A'
         91        SEND_VAL                                                 ~58
         92        DO_ICALL                                                 
   29    93        INIT_FCALL                                               'print_r'
         94        CONCAT                                           ~60     'FILTERED+STRING%3A+', !0
         95        CONCAT                                           ~61     ~60, '%0A'
         96        SEND_VAL                                                 ~61
         97        DO_ICALL                                                 
   30    98        INIT_FCALL                                               'print_r'
         99        SEND_VAL                                                 'MATCHES%3A+%0A'
        100        DO_ICALL                                                 
   31   101        INIT_FCALL                                               'print_r'
        102        SEND_VAR                                                 !3
        103        DO_ICALL                                                 
        104      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
199.78 ms | 1404 KiB | 21 Q