3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ubbText = <<<TEXT [b]Hey[/b] [b]Hello[/b] TEXT; echo preg_replace_callback( "~\[b](.*?)\[/b]~si", function ($m) { static $counter = 0; return '<span class="b">' . (++$counter) . '. ' . $m[1] . '</span>'; }, $ubbText );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/viKP9
function name:  (null)
number of ops:  9
compiled vars:  !0 = $ubbText
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5Bb%5DHey%5B%2Fb%5D%0A%5Bb%5DHello%5B%2Fb%5D'
    8     1        INIT_FCALL                                               'preg_replace_callback'
    9     2        SEND_VAL                                                 '%7E%5C%5Bb%5D%28.%2A%3F%29%5C%5B%2Fb%5D%7Esi'
   10     3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   13     4        SEND_VAL                                                 ~2
   14     5        SEND_VAR                                                 !0
    8     6        DO_ICALL                                         $3      
   14     7        ECHO                                                     $3
   15     8      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/viKP9
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $m, !1 = $counter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        BIND_STATIC                                              !1
   12     2        PRE_INC                                          ~2      !1
          3        CONCAT                                           ~3      '%3Cspan+class%3D%22b%22%3E', ~2
          4        CONCAT                                           ~4      ~3, '.+'
          5        FETCH_DIM_R                                      ~5      !0, 1
          6        CONCAT                                           ~6      ~4, ~5
          7        CONCAT                                           ~7      ~6, '%3C%2Fspan%3E'
          8      > RETURN                                                   ~7
   13     9*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.48 ms | 997 KiB | 14 Q