3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ubbText = <<<TEXT [b]Hey[/b] [b]Hello[/b] TEXT; $counter = 0; do { $ubbText = preg_replace( "~\[b](.*?)\[/b]~si", '<span class="b">' . (++$counter) . '. $1</span>', $ubbText, 1, $count ); } while ($count); echo $ubbText;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
filename:       /in/BXTI0
function name:  (null)
number of ops:  16
compiled vars:  !0 = $ubbText, !1 = $counter, !2 = $count
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        ASSIGN                                                   !1, 0
   10     2    >   INIT_FCALL                                               'preg_replace'
   11     3        SEND_VAL                                                 '%7E%5C%5Bb%5D%28.%2A%3F%29%5C%5B%2Fb%5D%7Esi'
   12     4        PRE_INC                                          ~5      !1
          5        CONCAT                                           ~6      '%3Cspan+class%3D%22b%22%3E', ~5
          6        CONCAT                                           ~7      ~6, '.+%241%3C%2Fspan%3E'
          7        SEND_VAL                                                 ~7
   13     8        SEND_VAR                                                 !0
   14     9        SEND_VAL                                                 1
   15    10        SEND_REF                                                 !2
   10    11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !0, $8
   17    13      > JMPNZ                                                    !2, ->2
   18    14    >   ECHO                                                     !0
   19    15      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.49 ms | 997 KiB | 14 Q