3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = "xxx - 12, ABC DEF GHI"; $pattern = "/([A-Z]+ - [0-9]+,) ([A-Z\s]+)/i"; $replace = "$1 ($2)"; echo preg_replace($pattern,$replace,$str);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/025DN
function name:  (null)
number of ops:  7
compiled vars:  !0 = $str, !1 = $pattern, !2 = $replace
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'xxx+-+12%2C+ABC+DEF+GHI'
    4     1        ASSIGN                                                       !1, '%2F%28%5BA-Z%5D%2B+-+%5B0-9%5D%2B%2C%29+%28%5BA-Z%5Cs%5D%2B%29%2Fi'
    5     2        ASSIGN                                                       !2, '%241+%28%242%29'
    6     3        FRAMELESS_ICALL_3                preg_replace        ~6      !1, !2
          4        OP_DATA                                                      !0
          5        ECHO                                                         ~6
          6      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.76 ms | 2587 KiB | 13 Q