3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = '[title type="1"]Test[/title]'; $pattern = '#\[(\w+)([^\]]+)](\w+).*#i'; echo preg_replace($pattern, '[new_title$2 title="$3"]', $content);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CQq4c
function name:  (null)
number of ops:  9
compiled vars:  !0 = $content, !1 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%5Btitle+type%3D%221%22%5DTest%5B%2Ftitle%5D'
    3     1        ASSIGN                                                   !1, '%23%5C%5B%28%5Cw%2B%29%28%5B%5E%5C%5D%5D%2B%29%5D%28%5Cw%2B%29.%2A%23i'
    4     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 '%5Bnew_title%242+title%3D%22%243%22%5D'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        ECHO                                                     $4
          8      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.85 ms | 1003 KiB | 14 Q