3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '§f§lWORDHERE'; $replacements = [ '§f' => '<span style="color: white;">$0</span>', '§l' => '<b>$0</b>', ]; if (preg_match('/^(?<flags>(?:§[a-z])+)(?<string>.*)/iu', $str, $matches)) { $str_res = $matches['string']; foreach (mb_str_split($matches['flags'], 2) as $flag) { $str_res = preg_replace('/.+/', $replacements[$flag], $str_res); } echo $str_res; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 27
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 25
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
Branch analysis from position: 27
filename:       /in/MC18s
function name:  (null)
number of ops:  28
compiled vars:  !0 = $str, !1 = $replacements, !2 = $matches, !3 = $str_res, !4 = $flag
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%C2%A7f%C2%A7lWORDHERE'
    5     1        ASSIGN                                                   !1, <array>
   10     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%2F%5E%28%3F%3Cflags%3E%28%3F%3A%C2%A7%5Ba-z%5D%29%2B%29%28%3F%3Cstring%3E.%2A%29%2Fiu'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $7      
          7      > JMPZ                                                     $7, ->27
   11     8    >   FETCH_DIM_R                                      ~8      !2, 'string'
          9        ASSIGN                                                   !3, ~8
   13    10        INIT_FCALL                                               'mb_str_split'
         11        FETCH_DIM_R                                      ~10     !2, 'flags'
         12        SEND_VAL                                                 ~10
         13        SEND_VAL                                                 2
         14        DO_ICALL                                         $11     
         15      > FE_RESET_R                                       $12     $11, ->25
         16    > > FE_FETCH_R                                               $12, !4, ->25
   14    17    >   INIT_FCALL                                               'preg_replace'
         18        SEND_VAL                                                 '%2F.%2B%2F'
         19        FETCH_DIM_R                                      ~13     !1, !4
         20        SEND_VAL                                                 ~13
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $14     
         23        ASSIGN                                                   !3, $14
   13    24      > JMP                                                      ->16
         25    >   FE_FREE                                                  $12
   17    26        ECHO                                                     !3
   18    27    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.76 ms | 1008 KiB | 16 Q