3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '1st blah blah <!-- CONTACT FORM START [CONTACT_FORM_1] -->some form goes here<!-- CONTACT FORM END 1 --> 2nd blah blah <!-- CONTACT FORM START [CONTACT_FORM_2] -->another form goes here<!-- CONTACT FORM END 2 -->'; $pattern = '/<!-- CONTACT FORM START \[CONTACT_FORM_(\d+)\] -->.*<!-- CONTACT FORM END \1 -->/'; $replace = preg_replace($pattern, '[CONTACT_FORM_$1]', $str); echo $replace;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fSkXE
function name:  (null)
number of ops:  10
compiled vars:  !0 = $str, !1 = $pattern, !2 = $replace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '1st+blah+blah+%3C%21--+CONTACT+FORM+START+%5BCONTACT_FORM_1%5D+--%3Esome+form+goes+here%3C%21--+CONTACT+FORM+END+1+--%3E+2nd+blah+blah+%3C%21--+CONTACT+FORM+START+%5BCONTACT_FORM_2%5D+--%3Eanother+form+goes+here%3C%21--+CONTACT+FORM+END+2+--%3E'
    3     1        ASSIGN                                                   !1, '%2F%3C%21--+CONTACT+FORM+START+%5C%5BCONTACT_FORM_%28%5Cd%2B%29%5C%5D+--%3E.%2A%3C%21--+CONTACT+FORM+END+%5C1+--%3E%2F'
    4     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 '%5BCONTACT_FORM_%241%5D'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !2, $5
    5     8        ECHO                                                     !2
          9      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.68 ms | 1398 KiB | 15 Q