3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '[a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="344747585151010c745359555d581a575b59"]'; function bb_parse($string) { $tags = 'b|i|size|color|center|quote|url|img'; while (preg_match_all('`\[('.$tags.')=?(.*?)\](.+?)\[/\1\]`', $string, $matches)) foreach ($matches[0] as $key => $match) { list($tag, $param, $innertext) = array($matches[1][$key], $matches[2][$key], $matches[3][$key]); switch ($tag) { case 'b': $replacement = "<strong>$innertext</strong>"; break; case 'i': $replacement = "<em>$innertext</em>"; break; case 'size': $replacement = "<span style=\"font-size: $param;\">$innertext</span>"; break; case 'color': $replacement = "<span style=\"color: $param;\">$innertext</span>"; break; case 'center': $replacement = "<div class=\"centered\">$innertext</div>"; break; case 'quote': $replacement = "<blockquote>$innertext</blockquote>" . $param? "<cite>$param</cite>" : ''; break; case 'url': $replacement = '<a href="' . ($param? $param : $innertext) . "\">$innertext</a>"; break; case 'img': list($width, $height) = preg_split('`[Xx]`', $param); $replacement = "<img src=\"$innertext\" " . (is_numeric($width)? "width=\"$width\" " : '') . (is_numeric($height)? "height=\"$height\" " : '') . '/>'; break; case 'video': $videourl = parse_url($innertext); parse_str($videourl['query'], $videoquery); if (strpos($videourl['host'], 'youtube.com') !== FALSE) $replacement = '<embed src="http://www.youtube.com/v/' . $videoquery['v'] . '" type="application/x-shockwave-flash" width="425" height="344"></embed>'; if (strpos($videourl['host'], 'google.com') !== FALSE) $replacement = '<embed src="http://video.google.com/googleplayer.swf?docid=' . $videoquery['docid'] . '" width="400" height="326" type="application/x-shockwave-flash"></embed>'; break; } $string = str_replace($match, $replacement, $string); } return $string; } echo bb_parse($string);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vB3XI
function name:  (null)
number of ops:  6
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%5Ba+href%3D%22%2Fcdn-cgi%2Fl%2Femail-protection%22+class%3D%22__cf_email__%22+data-cfemail%3D%22344747585151010c745359555d581a575b59%22%5D'
   30     1        INIT_FCALL                                               'bb_parse'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function bb_parse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 173
Branch analysis from position: 173
2 jumps found. (Code = 44) Position 1 = 181, Position 2 = 3
Branch analysis from position: 181
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 172
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 172
Branch analysis from position: 6
11 jumps found. (Code = 188) Position 1 = 43, Position 2 = 48, Position 3 = 53, Position 4 = 60, Position 5 = 67, Position 6 = 72, Position 7 = 85, Position 8 = 96, Position 9 = 133, Position 10 = 165, Position 11 = 24
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 77, Position 2 = 82
Branch analysis from position: 77
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 82
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 85
2 jumps found. (Code = 43) Position 1 = 86, Position 2 = 88
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 89
Branch analysis from position: 89
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 88
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 96
2 jumps found. (Code = 43) Position 1 = 112, Position 2 = 117
Branch analysis from position: 112
1 jumps found. (Code = 42) Position 1 = 118
Branch analysis from position: 118
2 jumps found. (Code = 43) Position 1 = 123, Position 2 = 128
Branch analysis from position: 123
1 jumps found. (Code = 42) Position 1 = 129
Branch analysis from position: 129
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 128
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 117
2 jumps found. (Code = 43) Position 1 = 123, Position 2 = 128
Branch analysis from position: 123
Branch analysis from position: 128
Branch analysis from position: 133
2 jumps found. (Code = 43) Position 1 = 149, Position 2 = 153
Branch analysis from position: 149
2 jumps found. (Code = 43) Position 1 = 160, Position 2 = 164
Branch analysis from position: 160
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 164
Branch analysis from position: 153
Branch analysis from position: 165
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 43
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 48
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 53
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 60
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 67
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 72
Branch analysis from position: 36
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 85
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 96
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 133
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 165
Branch analysis from position: 165
Branch analysis from position: 133
Branch analysis from position: 96
Branch analysis from position: 85
Branch analysis from position: 72
Branch analysis from position: 67
Branch analysis from position: 60
Branch analysis from position: 53
Branch analysis from position: 48
Branch analysis from position: 43
Branch analysis from position: 172
2 jumps found. (Code = 44) Position 1 = 181, Position 2 = 3
Branch analysis from position: 181
Branch analysis from position: 3
Branch analysis from position: 172
filename:       /in/vB3XI
function name:  bb_parse
number of ops:  183
compiled vars:  !0 = $string, !1 = $tags, !2 = $matches, !3 = $match, !4 = $key, !5 = $tag, !6 = $param, !7 = $innertext, !8 = $replacement, !9 = $width, !10 = $height, !11 = $videourl, !12 = $videoquery
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, 'b%7Ci%7Csize%7Ccolor%7Ccenter%7Cquote%7Curl%7Cimg'
    5     2      > JMP                                                      ->173
          3    >   FETCH_DIM_R                                      ~14     !2, 0
          4      > FE_RESET_R                                       $15     ~14, ->172
          5    > > FE_FETCH_R                                       ~16     $15, !3, ->172
          6    >   ASSIGN                                                   !4, ~16
    6     7        FETCH_DIM_R                                      ~18     !2, 1
          8        FETCH_DIM_R                                      ~19     ~18, !4
          9        INIT_ARRAY                                       ~20     ~19
         10        FETCH_DIM_R                                      ~21     !2, 2
         11        FETCH_DIM_R                                      ~22     ~21, !4
         12        ADD_ARRAY_ELEMENT                                ~20     ~22
         13        FETCH_DIM_R                                      ~23     !2, 3
         14        FETCH_DIM_R                                      ~24     ~23, !4
         15        ADD_ARRAY_ELEMENT                                ~20     ~24
         16        FETCH_LIST_R                                     $25     ~20, 0
         17        ASSIGN                                                   !5, $25
         18        FETCH_LIST_R                                     $27     ~20, 1
         19        ASSIGN                                                   !6, $27
         20        FETCH_LIST_R                                     $29     ~20, 2
         21        ASSIGN                                                   !7, $29
         22        FREE                                                     ~20
    7    23      > SWITCH_STRING                                            !5, [ 'b':->43, 'i':->48, 'size':->53, 'color':->60, 'center':->67, 'quote':->72, 'url':->85, 'img':->96, 'video':->133, ], ->165
    8    24    >   IS_EQUAL                                                 !5, 'b'
         25      > JMPNZ                                                    ~31, ->43
    9    26    >   IS_EQUAL                                                 !5, 'i'
         27      > JMPNZ                                                    ~31, ->48
   10    28    >   IS_EQUAL                                                 !5, 'size'
         29      > JMPNZ                                                    ~31, ->53
   11    30    >   IS_EQUAL                                                 !5, 'color'
         31      > JMPNZ                                                    ~31, ->60
   12    32    >   IS_EQUAL                                                 !5, 'center'
         33      > JMPNZ                                                    ~31, ->67
   13    34    >   IS_EQUAL                                                 !5, 'quote'
         35      > JMPNZ                                                    ~31, ->72
   14    36    >   IS_EQUAL                                                 !5, 'url'
         37      > JMPNZ                                                    ~31, ->85
   15    38    >   IS_EQUAL                                                 !5, 'img'
         39      > JMPNZ                                                    ~31, ->96
   19    40    >   IS_EQUAL                                                 !5, 'video'
         41      > JMPNZ                                                    ~31, ->133
         42    > > JMP                                                      ->165
    8    43    >   ROPE_INIT                                     3  ~33     '%3Cstrong%3E'
         44        ROPE_ADD                                      1  ~33     ~33, !7
         45        ROPE_END                                      2  ~32     ~33, '%3C%2Fstrong%3E'
         46        ASSIGN                                                   !8, ~32
         47      > JMP                                                      ->165
    9    48    >   ROPE_INIT                                     3  ~37     '%3Cem%3E'
         49        ROPE_ADD                                      1  ~37     ~37, !7
         50        ROPE_END                                      2  ~36     ~37, '%3C%2Fem%3E'
         51        ASSIGN                                                   !8, ~36
         52      > JMP                                                      ->165
   10    53    >   ROPE_INIT                                     5  ~41     '%3Cspan+style%3D%22font-size%3A+'
         54        ROPE_ADD                                      1  ~41     ~41, !6
         55        ROPE_ADD                                      2  ~41     ~41, '%3B%22%3E'
         56        ROPE_ADD                                      3  ~41     ~41, !7
         57        ROPE_END                                      4  ~40     ~41, '%3C%2Fspan%3E'
         58        ASSIGN                                                   !8, ~40
         59      > JMP                                                      ->165
   11    60    >   ROPE_INIT                                     5  ~46     '%3Cspan+style%3D%22color%3A+'
         61        ROPE_ADD                                      1  ~46     ~46, !6
         62        ROPE_ADD                                      2  ~46     ~46, '%3B%22%3E'
         63        ROPE_ADD                                      3  ~46     ~46, !7
         64        ROPE_END                                      4  ~45     ~46, '%3C%2Fspan%3E'
         65        ASSIGN                                                   !8, ~45
         66      > JMP                                                      ->165
   12    67    >   ROPE_INIT                                     3  ~51     '%3Cdiv+class%3D%22centered%22%3E'
         68        ROPE_ADD                                      1  ~51     ~51, !7
         69        ROPE_END                                      2  ~50     ~51, '%3C%2Fdiv%3E'
         70        ASSIGN                                                   !8, ~50
         71      > JMP                                                      ->165
   13    72    >   ROPE_INIT                                     3  ~55     '%3Cblockquote%3E'
         73        ROPE_ADD                                      1  ~55     ~55, !7
         74        ROPE_END                                      2  ~54     ~55, '%3C%2Fblockquote%3E'
         75        CONCAT                                           ~57     ~54, !6
         76      > JMPZ                                                     ~57, ->82
         77    >   ROPE_INIT                                     3  ~59     '%3Ccite%3E'
         78        ROPE_ADD                                      1  ~59     ~59, !6
         79        ROPE_END                                      2  ~58     ~59, '%3C%2Fcite%3E'
         80        QM_ASSIGN                                        ~61     ~58
         81      > JMP                                                      ->83
         82    >   QM_ASSIGN                                        ~61     ''
         83    >   ASSIGN                                                   !8, ~61
         84      > JMP                                                      ->165
   14    85    > > JMPZ                                                     !6, ->88
         86    >   QM_ASSIGN                                        ~63     !6
         87      > JMP                                                      ->89
         88    >   QM_ASSIGN                                        ~63     !7
         89    >   CONCAT                                           ~64     '%3Ca+href%3D%22', ~63
         90        ROPE_INIT                                     3  ~66     '%22%3E'
         91        ROPE_ADD                                      1  ~66     ~66, !7
         92        ROPE_END                                      2  ~65     ~66, '%3C%2Fa%3E'
         93        CONCAT                                           ~68     ~64, ~65
         94        ASSIGN                                                   !8, ~68
         95      > JMP                                                      ->165
   16    96    >   INIT_FCALL                                               'preg_split'
         97        SEND_VAL                                                 '%60%5BXx%5D%60'
         98        SEND_VAR                                                 !6
         99        DO_ICALL                                         $70     
        100        FETCH_LIST_R                                     $71     $70, 0
        101        ASSIGN                                                   !9, $71
        102        FETCH_LIST_R                                     $73     $70, 1
        103        ASSIGN                                                   !10, $73
        104        FREE                                                     $70
   17   105        ROPE_INIT                                     3  ~76     '%3Cimg+src%3D%22'
        106        ROPE_ADD                                      1  ~76     ~76, !7
        107        ROPE_END                                      2  ~75     ~76, '%22+'
        108        INIT_FCALL                                               'is_numeric'
        109        SEND_VAR                                                 !9
        110        DO_ICALL                                         $78     
        111      > JMPZ                                                     $78, ->117
        112    >   ROPE_INIT                                     3  ~80     'width%3D%22'
        113        ROPE_ADD                                      1  ~80     ~80, !9
        114        ROPE_END                                      2  ~79     ~80, '%22+'
        115        QM_ASSIGN                                        ~82     ~79
        116      > JMP                                                      ->118
        117    >   QM_ASSIGN                                        ~82     ''
        118    >   CONCAT                                           ~83     ~75, ~82
        119        INIT_FCALL                                               'is_numeric'
        120        SEND_VAR                                                 !10
        121        DO_ICALL                                         $84     
        122      > JMPZ                                                     $84, ->128
        123    >   ROPE_INIT                                     3  ~86     'height%3D%22'
        124        ROPE_ADD                                      1  ~86     ~86, !10
        125        ROPE_END                                      2  ~85     ~86, '%22+'
        126        QM_ASSIGN                                        ~88     ~85
        127      > JMP                                                      ->129
        128    >   QM_ASSIGN                                        ~88     ''
        129    >   CONCAT                                           ~89     ~83, ~88
        130        CONCAT                                           ~90     ~89, '%2F%3E'
        131        ASSIGN                                                   !8, ~90
   18   132      > JMP                                                      ->165
   20   133    >   INIT_FCALL                                               'parse_url'
        134        SEND_VAR                                                 !7
        135        DO_ICALL                                         $92     
        136        ASSIGN                                                   !11, $92
   21   137        INIT_FCALL                                               'parse_str'
        138        FETCH_DIM_R                                      ~94     !11, 'query'
        139        SEND_VAL                                                 ~94
        140        SEND_REF                                                 !12
        141        DO_ICALL                                                 
   22   142        INIT_FCALL                                               'strpos'
        143        FETCH_DIM_R                                      ~96     !11, 'host'
        144        SEND_VAL                                                 ~96
        145        SEND_VAL                                                 'youtube.com'
        146        DO_ICALL                                         $97     
        147        TYPE_CHECK                                  1018          $97
        148      > JMPZ                                                     ~98, ->153
        149    >   FETCH_DIM_R                                      ~99     !12, 'v'
        150        CONCAT                                           ~100    '%3Cembed+src%3D%22http%3A%2F%2Fwww.youtube.com%2Fv%2F', ~99
        151        CONCAT                                           ~101    ~100, '%22+type%3D%22application%2Fx-shockwave-flash%22+width%3D%22425%22+height%3D%22344%22%3E%3C%2Fembed%3E'
        152        ASSIGN                                                   !8, ~101
   23   153    >   INIT_FCALL                                               'strpos'
        154        FETCH_DIM_R                                      ~103    !11, 'host'
        155        SEND_VAL                                                 ~103
        156        SEND_VAL                                                 'google.com'
        157        DO_ICALL                                         $104    
        158        TYPE_CHECK                                  1018          $104
        159      > JMPZ                                                     ~105, ->164
        160    >   FETCH_DIM_R                                      ~106    !12, 'docid'
        161        CONCAT                                           ~107    '%3Cembed+src%3D%22http%3A%2F%2Fvideo.google.com%2Fgoogleplayer.swf%3Fdocid%3D', ~106
        162        CONCAT                                           ~108    ~107, '%22+width%3D%22400%22+height%3D%22326%22+type%3D%22application%2Fx-shockwave-flash%22%3E%3C%2Fembed%3E'
        163        ASSIGN                                                   !8, ~108
   24   164    > > JMP                                                      ->165
   26   165    >   INIT_FCALL                                               'str_replace'
        166        SEND_VAR                                                 !3
        167        SEND_VAR                                                 !8
        168        SEND_VAR                                                 !0
        169        DO_ICALL                                         $110    
        170        ASSIGN                                                   !0, $110
    5   171      > JMP                                                      ->5
        172    >   FE_FREE                                                  $15
        173    >   INIT_FCALL                                               'preg_match_all'
        174        CONCAT                                           ~112    '%60%5C%5B%28', !1
        175        CONCAT                                           ~113    ~112, '%29%3D%3F%28.%2A%3F%29%5C%5D%28.%2B%3F%29%5C%5B%2F%5C1%5C%5D%60'
        176        SEND_VAL                                                 ~113
        177        SEND_VAR                                                 !0
        178        SEND_REF                                                 !2
        179        DO_ICALL                                         $114    
        180      > JMPNZ                                                    $114, ->3
   28   181    > > RETURN                                                   !0
   29   182*     > RETURN                                                   null

End of function bb_parse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.33 ms | 1410 KiB | 28 Q