3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'D:/Inetpub/v5.easylearn.ch/upload/content/4/3814_firstinsert.zip'; $searchTerm = "abcd"; $replaceTerm = "XXXX"; $test=array("${searchTerm}/${searchTerm}_.${searchTerm}", "xay${searchTerm}", "asdasd/${searchTerm}.mp3", "${searchTerm}.", "blahahbasd${searchTerm}", "1234${searchTerm}1234"); foreach ($test as $t) echo "$t => " . preg_replace("/". preg_quote($searchTerm) . "([^_.]|$)/x", preg_quote($replaceTerm) . "\${1}", $t) . "\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 49
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 49
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
filename:       /in/pjonf
function name:  (null)
number of ops:  51
compiled vars:  !0 = $searchTerm, !1 = $replaceTerm, !2 = $test, !3 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ECHO                                                     'D%3A%2FInetpub%2Fv5.easylearn.ch%2Fupload%2Fcontent%2F4%2F3814_firstinsert.zip'
    3     1        ASSIGN                                                   !0, 'abcd'
    4     2        ASSIGN                                                   !1, 'XXXX'
    5     3        ROPE_INIT                                     5  ~7      !0
          4        ROPE_ADD                                      1  ~7      ~7, '%2F'
          5        ROPE_ADD                                      2  ~7      ~7, !0
          6        ROPE_ADD                                      3  ~7      ~7, '_.'
          7        ROPE_END                                      4  ~6      ~7, !0
          8        INIT_ARRAY                                       ~10     ~6
          9        NOP                                                      
         10        FAST_CONCAT                                      ~11     'xay', !0
         11        ADD_ARRAY_ELEMENT                                ~10     ~11
         12        ROPE_INIT                                     3  ~13     'asdasd%2F'
         13        ROPE_ADD                                      1  ~13     ~13, !0
         14        ROPE_END                                      2  ~12     ~13, '.mp3'
         15        ADD_ARRAY_ELEMENT                                ~10     ~12
         16        NOP                                                      
         17        FAST_CONCAT                                      ~15     !0, '.'
         18        ADD_ARRAY_ELEMENT                                ~10     ~15
         19        NOP                                                      
         20        FAST_CONCAT                                      ~16     'blahahbasd', !0
         21        ADD_ARRAY_ELEMENT                                ~10     ~16
         22        ROPE_INIT                                     3  ~18     '1234'
         23        ROPE_ADD                                      1  ~18     ~18, !0
         24        ROPE_END                                      2  ~17     ~18, '1234'
         25        ADD_ARRAY_ELEMENT                                ~10     ~17
         26        ASSIGN                                                   !2, ~10
    6    27      > FE_RESET_R                                       $21     !2, ->49
         28    > > FE_FETCH_R                                               $21, !3, ->49
    7    29    >   NOP                                                      
         30        FAST_CONCAT                                      ~22     !3, '+%3D%3E+'
         31        INIT_FCALL                                               'preg_replace'
         32        INIT_FCALL                                               'preg_quote'
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                         $23     
         35        CONCAT                                           ~24     '%2F', $23
         36        CONCAT                                           ~25     ~24, '%28%5B%5E_.%5D%7C%24%29%2Fx'
         37        SEND_VAL                                                 ~25
         38        INIT_FCALL                                               'preg_quote'
         39        SEND_VAR                                                 !1
         40        DO_ICALL                                         $26     
         41        CONCAT                                           ~27     $26, '%24%7B1%7D'
         42        SEND_VAL                                                 ~27
         43        SEND_VAR                                                 !3
         44        DO_ICALL                                         $28     
         45        CONCAT                                           ~29     ~22, $28
         46        CONCAT                                           ~30     ~29, '%0A'
         47        ECHO                                                     ~30
    6    48      > JMP                                                      ->28
         49    >   FE_FREE                                                  $21
    7    50      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.1 ms | 1400 KiB | 17 Q