3v4l.org

run code in 500+ PHP versions simultaneously
<?php $sentence = '[html style="font-size: 18px;" dir="ltr"][div style="font-size: 18px;" dir="ltr"][p style="font-weight: bold;"]Hello,[/p][p]You have got a new message from [a href="https://www.example.com/"]Example.com[/a][br][br].You could check your message on [a href="https://www.example.com/en/manager/inbox.html"]Manager[/a][/p][p][img src="https://www.example.com/assets/images/logo-default-120x50.png" width="120px" height="80px"][div style="color: #D4192D; font-weight: bold;"]Example.com Team[/div][/p][/div][/html]'; $rx = '~\[((\w+)\b[^]]*)\]((?>(?!\[\2\b).|(?R))*)\[\/\2]~s'; $tmp = ''; while (preg_match($rx, $sentence) && $tmp != $sentence) { $tmp = $sentence; $sentence = preg_replace($rx, '<$1>$3</$2>', $sentence); } $sentence = preg_replace('~\[([^]]*)]~', '<$1 />', $sentence); echo $sentence;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
Branch analysis from position: 12
Branch analysis from position: 12
filename:       /in/WcWuu
function name:  (null)
number of ops:  18
compiled vars:  !0 = $sentence, !1 = $rx, !2 = $tmp
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%5Bhtml+style%3D%22font-size%3A+18px%3B%22+dir%3D%22ltr%22%5D%5Bdiv+style%3D%22font-size%3A+18px%3B%22+dir%3D%22ltr%22%5D%5Bp+style%3D%22font-weight%3A+bold%3B%22%5DHello%2C%5B%2Fp%5D%5Bp%5DYou+have+got+a+new+message+from+%5Ba+href%3D%22https%3A%2F%2Fwww.example.com%2F%22%5DExample.com%5B%2Fa%5D%5Bbr%5D%5Bbr%5D.You+could+check+your+message+on+%5Ba+href%3D%22https%3A%2F%2Fwww.example.com%2Fen%2Fmanager%2Finbox.html%22%5DManager%5B%2Fa%5D%5B%2Fp%5D%5Bp%5D%5Bimg+src%3D%22https%3A%2F%2Fwww.example.com%2Fassets%2Fimages%2Flogo-default-120x50.png%22+width%3D%22120px%22+height%3D%2280px%22%5D%5Bdiv+style%3D%22color%3A+%23D4192D%3B+font-weight%3A+bold%3B%22%5DExample.com+Team%5B%2Fdiv%5D%5B%2Fp%5D%5B%2Fdiv%5D%5B%2Fhtml%5D'
    5     1        ASSIGN                                                       !1, '%7E%5C%5B%28%28%5Cw%2B%29%5Cb%5B%5E%5D%5D%2A%29%5C%5D%28%28%3F%3E%28%3F%21%5C%5B%5C2%5Cb%29.%7C%28%3FR%29%29%2A%29%5C%5B%5C%2F%5C2%5D%7Es'
    6     2        ASSIGN                                                       !2, ''
    7     3      > JMP                                                          ->8
    8     4    >   ASSIGN                                                       !2, !0
    9     5        FRAMELESS_ICALL_3                preg_replace        ~7      !1, '%3C%241%3E%243%3C%2F%242%3E'
          6        OP_DATA                                                      !0
          7        ASSIGN                                                       !0, ~7
    7     8    >   FRAMELESS_ICALL_2                preg_match          ~9      !1, !0
          9      > JMPZ_EX                                              ~9      ~9, ->12
         10    >   IS_NOT_EQUAL                                         ~10     !2, !0
         11        BOOL                                                 ~9      ~10
         12    > > JMPNZ                                                        ~9, ->4
   11    13    >   FRAMELESS_ICALL_3                preg_replace        ~11     '%7E%5C%5B%28%5B%5E%5D%5D%2A%29%5D%7E', '%3C%241+%2F%3E'
         14        OP_DATA                                                      !0
         15        ASSIGN                                                       !0, ~11
   12    16        ECHO                                                         !0
   13    17      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
154.57 ms | 2142 KiB | 13 Q