3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'Hello "world". [start]this is a "mark"[end]. It should work with [start]"several" "marks"[end]'; $regex = '/(?s)"(?=((?!\[start\]).)*\[end\])/'; $replace = '&quot;'; echo preg_replace($regex, $replace, $string);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OjFFE
function name:  (null)
number of ops:  10
compiled vars:  !0 = $string, !1 = $regex, !2 = $replace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Hello+%22world%22.+%5Bstart%5Dthis+is+a+%22mark%22%5Bend%5D.+It+should+work+with+%5Bstart%5D%22several%22+%22marks%22%5Bend%5D'
    4     1        ASSIGN                                                   !1, '%2F%28%3Fs%29%22%28%3F%3D%28%28%3F%21%5C%5Bstart%5C%5D%29.%29%2A%5C%5Bend%5C%5D%29%2F'
    5     2        ASSIGN                                                   !2, '%26quot%3B'
    7     3        INIT_FCALL                                               'preg_replace'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !2
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        ECHO                                                     $6
          9      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.99 ms | 1009 KiB | 14 Q