3v4l.org

run code in 300+ PHP versions simultaneously
<?php $txt = '!1 aaa !2 bb bb !5 cc cc cc !4 dd'; echo preg_replace('~!(\d+)\s*(.*?)\s*(?=!\d|$)~s', "<div class=\"x\$1\">\$2</div>\n", $txt);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uFr20
function name:  (null)
number of ops:  8
compiled vars:  !0 = $txt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%211+aaa+%212+bb+bb+%215+cc+cc+cc+%214+dd'
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%7E%21%28%5Cd%2B%29%5Cs%2A%28.%2A%3F%29%5Cs%2A%28%3F%3D%21%5Cd%7C%24%29%7Es'
          3        SEND_VAL                                                 '%3Cdiv+class%3D%22x%241%22%3E%242%3C%2Fdiv%3E%0A'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ECHO                                                     $2
          7      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.67 ms | 1008 KiB | 14 Q