3v4l.org

run code in 500+ PHP versions simultaneously
<?php function replace_between_something($betweenWhat, $replace_thing, $target) { return preg_replace("/" . preg_quote($betweenWhat) . "(.*?)" . preg_quote($betweenWhat) . "/", $betweenWhat.$replace_thing.$betweenWhat, $target); } $string = "Hi, *my* name is 'Soul' and she is 'Maggie'. "; $replace = replace_between_something("*", "your", $string) . "\n"; $replace = replace_between_something("'", "noname", $replace); echo $replace;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7KHYL
function name:  (null)
number of ops:  16
compiled vars:  !0 = $string, !1 = $replace
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                       !0, 'Hi%2C+%2Amy%2A+name+is+%27Soul%27+and+she+is+%27Maggie%27.+'
    9     1        INIT_FCALL                                                   'replace_between_something'
          2        SEND_VAL                                                     '%2A'
          3        SEND_VAL                                                     'your'
          4        SEND_VAR                                                     !0
          5        DO_FCALL                                          0  $3      
          6        CONCAT                                               ~4      $3, '%0A'
          7        ASSIGN                                                       !1, ~4
   10     8        INIT_FCALL                                                   'replace_between_something'
          9        SEND_VAL                                                     '%27'
         10        SEND_VAL                                                     'noname'
         11        SEND_VAR                                                     !1
         12        DO_FCALL                                          0  $6      
         13        ASSIGN                                                       !1, $6
   12    14        ECHO                                                         !1
         15      > RETURN                                                       1

Function replace_between_something:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7KHYL
function name:  replace_between_something
number of ops:  19
compiled vars:  !0 = $betweenWhat, !1 = $replace_thing, !2 = $target
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
    4     3        INIT_FCALL                                                   'preg_quote'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $3      
          6        CONCAT                                               ~4      '%2F', $3
          7        CONCAT                                               ~5      ~4, '%28.%2A%3F%29'
          8        INIT_FCALL                                                   'preg_quote'
          9        SEND_VAR                                                     !0
         10        DO_ICALL                                             $6      
         11        CONCAT                                               ~7      ~5, $6
         12        CONCAT                                               ~8      ~7, '%2F'
         13        CONCAT                                               ~9      !0, !1
         14        CONCAT                                               ~10     ~9, !0
         15        FRAMELESS_ICALL_3                preg_replace        ~11     ~8, ~10
         16        OP_DATA                                                      !2
         17      > RETURN                                                       ~11
    5    18*     > RETURN                                                       null

End of function replace_between_something

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
271.63 ms | 2108 KiB | 17 Q