3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bbcodequote2html($matches){ $text=(isset($matches[2])?$matches[2]:''); // avoid Notices if(isset($matches[1]) && ctype_digit($matches[1])){ $TPID = "#{$matches[1]}"; // GetThreadPoster($match[1]); $TPUN = "#{$matches[1]}"; // GetUsernameS($TPID); $quotee="<br>- <b>$TPUN</b>"; }else{ $quotee=''; // no id value or id is non-numeric default to empty string } return "<div class=\"panel panel-default\"><div class=\"panel-heading\">$text$quotee</div></div>"; } $bbcode=<<<BBCODE [quote=2]Outer Quote[b]bold [b]nested bold[/b][/b] [i]italic [i]nested italic[/i][/i][quote]Inner Quote 1: (no id)[/quote] [quote=bitethatapple]Inner Quote 2[quote=1]Inner Quote 3[/quote] still inner quote 2 [quote=mickmackusa]Inner Quote 4[/quote] end of inner quote 2[/quote][/quote] BBCODE; $converted=str_replace( ['[b]','[/b]','[i]','[/i]'], ['<b>','</b>','<i style=\"all:unset;font-style:italic;\">','</i>'], $bbcode ); $tabs="\t"; do{ $converted=preg_replace_callback('~\[quote(?:=(.+?))?]((?:(?R)|.*?)+)\[/quote]~is','bbcodequote2html',$converted,-1,$count); }while($count); echo $converted;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/YSZQP
function name:  (null)
number of ops:  19
compiled vars:  !0 = $bbcode, !1 = $converted, !2 = $tabs, !3 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, '%5Bquote%3D2%5DOuter+Quote%5Bb%5Dbold+%5Bb%5Dnested+bold%5B%2Fb%5D%5B%2Fb%5D%0A%5Bi%5Ditalic+%5Bi%5Dnested+italic%5B%2Fi%5D%5B%2Fi%5D%5Bquote%5DInner+Quote+1%3A+%28no+id%29%5B%2Fquote%5D%0A%5Bquote%3Dbitethatapple%5DInner+Quote+2%5Bquote%3D1%5DInner+Quote+3%5B%2Fquote%5D+still+inner+quote+2+%5Bquote%3Dmickmackusa%5DInner+Quote+4%5B%2Fquote%5D+end+of+inner+quote+2%5B%2Fquote%5D%5B%2Fquote%5D'
   20     1        INIT_FCALL                                               'str_replace'
   21     2        SEND_VAL                                                 <array>
   22     3        SEND_VAL                                                 <array>
   23     4        SEND_VAR                                                 !0
   20     5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !1, $5
   26     7        ASSIGN                                                   !2, '%09'
   28     8    >   INIT_FCALL                                               'preg_replace_callback'
          9        SEND_VAL                                                 '%7E%5C%5Bquote%28%3F%3A%3D%28.%2B%3F%29%29%3F%5D%28%28%3F%3A%28%3FR%29%7C.%2A%3F%29%2B%29%5C%5B%2Fquote%5D%7Eis'
         10        SEND_VAL                                                 'bbcodequote2html'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 -1
         13        SEND_REF                                                 !3
         14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !1, $8
   29    16      > JMPNZ                                                    !3, ->8
   31    17    >   ECHO                                                     !1
   32    18      > RETURN                                                   1

Function bbcodequote2html:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 29
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
Branch analysis from position: 15
filename:       /in/YSZQP
function name:  bbcodequote2html
number of ops:  36
compiled vars:  !0 = $matches, !1 = $text, !2 = $TPID, !3 = $TPUN, !4 = $quotee
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 2
          2      > JMPZ                                                     ~5, ->6
          3    >   FETCH_DIM_R                                      ~6      !0, 2
          4        QM_ASSIGN                                        ~7      ~6
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~7      ''
          7    >   ASSIGN                                                   !1, ~7
    4     8        ISSET_ISEMPTY_DIM_OBJ                         0  ~9      !0, 1
          9      > JMPZ_EX                                          ~9      ~9, ->15
         10    >   INIT_FCALL                                               'ctype_digit'
         11        FETCH_DIM_R                                      ~10     !0, 1
         12        SEND_VAL                                                 ~10
         13        DO_ICALL                                         $11     
         14        BOOL                                             ~9      $11
         15    > > JMPZ                                                     ~9, ->29
    5    16    >   NOP                                                      
         17        FETCH_DIM_R                                      ~12     !0, 1
         18        FAST_CONCAT                                      ~13     '%23', ~12
         19        ASSIGN                                                   !2, ~13
    6    20        NOP                                                      
         21        FETCH_DIM_R                                      ~15     !0, 1
         22        FAST_CONCAT                                      ~16     '%23', ~15
         23        ASSIGN                                                   !3, ~16
    7    24        ROPE_INIT                                     3  ~19     '%3Cbr%3E-+%3Cb%3E'
         25        ROPE_ADD                                      1  ~19     ~19, !3
         26        ROPE_END                                      2  ~18     ~19, '%3C%2Fb%3E'
         27        ASSIGN                                                   !4, ~18
    4    28      > JMP                                                      ->30
    9    29    >   ASSIGN                                                   !4, ''
   11    30    >   ROPE_INIT                                     4  ~24     '%3Cdiv+class%3D%22panel+panel-default%22%3E%3Cdiv+class%3D%22panel-heading%22%3E'
         31        ROPE_ADD                                      1  ~24     ~24, !1
         32        ROPE_ADD                                      2  ~24     ~24, !4
         33        ROPE_END                                      3  ~23     ~24, '%3C%2Fdiv%3E%3C%2Fdiv%3E'
         34      > RETURN                                                   ~23
   12    35*     > RETURN                                                   null

End of function bbcodequote2html

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.53 ms | 1005 KiB | 16 Q