3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = <<< 'TXT' {ff0000}red tex {00ff00}green text TXT; echo preg_replace('~{([a-fA-F0-9]+)}((?>[^{]*{?(?!(?1)}))*)~', '<span style="color: #$1">$2</span>', $text);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FvKn0
function name:  (null)
number of ops:  8
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7Bff0000%7Dred+tex+%7B00ff00%7Dgreen+text'
    7     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%7E%7B%28%5Ba-fA-F0-9%5D%2B%29%7D%28%28%3F%3E%5B%5E%7B%5D%2A%7B%3F%28%3F%21%28%3F1%29%7D%29%29%2A%29%7E'
    8     3        SEND_VAL                                                 '%3Cspan+style%3D%22color%3A+%23%241%22%3E%242%3C%2Fspan%3E'
          4        SEND_VAR                                                 !0
    7     5        DO_ICALL                                         $2      
    8     6        ECHO                                                     $2
          7      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.74 ms | 1008 KiB | 14 Q