3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "product#[:id]#[:str]"; $regex = preg_replace("/\[:(\w+)\]/", "(?<$1>.+?)", $string); echo $regex;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5du4h
function name:  (null)
number of ops:  9
compiled vars:  !0 = $string, !1 = $regex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'product%23%5B%3Aid%5D%23%5B%3Astr%5D'
    5     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%5C%5B%3A%28%5Cw%2B%29%5C%5D%2F'
          3        SEND_VAL                                                 '%28%3F%3C%241%3E.%2B%3F%29'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !1, $3
    7     7        ECHO                                                     !1
    8     8      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.61 ms | 998 KiB | 14 Q