3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getmsg($mbox,$mid) { global $charset,$htmlmsg,$plainmsg,$attachments; $htmlmsg = $plainmsg = $charset = ''; $attachments = array(); $h = imap_header($mbox,$mid); $s = imap_fetchstructure($mbox,$mid); if (!$s->parts) getpart($mbox,$mid,$s,0); else { foreach ($s->parts as $partno0=>$p) getpart($mbox,$mid,$p,$partno0+1); } echo $htmlmsg; } function getpart($mbox,$mid,$p,$partno) { global $htmlmsg,$plainmsg,$charset,$attachments; $data = ($partno)? imap_fetchbody($mbox,$mid,$partno): imap_body($mbox,$mid); if ($p->encoding==4) $data = quoted_printable_decode($data); elseif ($p->encoding==3) $data = base64_decode($data); $params = array(); if ($p->parameters) foreach ($p->parameters as $x) $params[strtolower($x->attribute)] = $x->value; if ($p->dparameters) foreach ($p->dparameters as $x) $params[strtolower($x->attribute)] = $x->value; if ($params['filename'] || $params['name']) { $filename = ($params['filename'])? $params['filename'] : $params['name']; $attachments[$filename] = $data; } if ($p->type==0 && $data) { if (strtolower($p->subtype)=='plain') $plainmsg.= trim($data) ."\n\n"; else $htmlmsg.= $data ."<br><br>"; $charset = $params['charset']; } elseif ($p->type==2 && $data) { $plainmsg.= $data."\n\n"; } if ($p->parts) { foreach ($p->parts as $partno0=>$p2) getpart($mbox,$mid,$p2,$partno.'.'.($partno0+1)); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O3jvf
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   63     0  E > > RETURN                                                   1

Function getmsg:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 30
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 77) Position 1 = 32, Position 2 = 42
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 42
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/O3jvf
function name:  getmsg
number of ops:  45
compiled vars:  !0 = $mbox, !1 = $mid, !2 = $charset, !3 = $htmlmsg, !4 = $plainmsg, !5 = $attachments, !6 = $h, !7 = $s, !8 = $p, !9 = $partno0
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        BIND_GLOBAL                                              !2, 'charset'
          3        BIND_GLOBAL                                              !3, 'htmlmsg'
          4        BIND_GLOBAL                                              !4, 'plainmsg'
          5        BIND_GLOBAL                                              !5, 'attachments'
    7     6        ASSIGN                                           ~10     !2, ''
          7        ASSIGN                                           ~11     !4, ~10
          8        ASSIGN                                                   !3, ~11
    8     9        ASSIGN                                                   !5, <array>
   10    10        INIT_FCALL_BY_NAME                                       'imap_header'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0  $14     
         14        ASSIGN                                                   !6, $14
   12    15        INIT_FCALL_BY_NAME                                       'imap_fetchstructure'
         16        SEND_VAR_EX                                              !0
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0  $16     
         19        ASSIGN                                                   !7, $16
   13    20        FETCH_OBJ_R                                      ~18     !7, 'parts'
         21        BOOL_NOT                                         ~19     ~18
         22      > JMPZ                                                     ~19, ->30
   14    23    >   INIT_FCALL_BY_NAME                                       'getpart'
         24        SEND_VAR_EX                                              !0
         25        SEND_VAR_EX                                              !1
         26        SEND_VAR_EX                                              !7
         27        SEND_VAL_EX                                              0
         28        DO_FCALL                                      0          
         29      > JMP                                                      ->43
   16    30    >   FETCH_OBJ_R                                      ~21     !7, 'parts'
         31      > FE_RESET_R                                       $22     ~21, ->42
         32    > > FE_FETCH_R                                       ~23     $22, !8, ->42
         33    >   ASSIGN                                                   !9, ~23
   17    34        INIT_FCALL_BY_NAME                                       'getpart'
         35        SEND_VAR_EX                                              !0
         36        SEND_VAR_EX                                              !1
         37        SEND_VAR_EX                                              !8
         38        ADD                                              ~25     !9, 1
         39        SEND_VAL_EX                                              ~25
         40        DO_FCALL                                      0          
   16    41      > JMP                                                      ->32
         42    >   FE_FREE                                                  $22
   19    43    >   ECHO                                                     !3
   20    44      > RETURN                                                   null

End of function getmsg

Function getpart:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 30
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 52
Branch analysis from position: 40
2 jumps found. (Code = 77) Position 1 = 42, Position 2 = 51
Branch analysis from position: 42
2 jumps found. (Code = 78) Position 1 = 43, Position 2 = 51
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 66
Branch analysis from position: 54
2 jumps found. (Code = 77) Position 1 = 56, Position 2 = 65
Branch analysis from position: 56
2 jumps found. (Code = 78) Position 1 = 57, Position 2 = 65
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
Branch analysis from position: 65
2 jumps found. (Code = 47) Position 1 = 68, Position 2 = 70
Branch analysis from position: 68
2 jumps found. (Code = 43) Position 1 = 71, Position 2 = 81
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 76
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
2 jumps found. (Code = 46) Position 1 = 84, Position 2 = 85
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 86, Position 2 = 103
Branch analysis from position: 86
2 jumps found. (Code = 43) Position 1 = 92, Position 2 = 98
Branch analysis from position: 92
1 jumps found. (Code = 42) Position 1 = 100
Branch analysis from position: 100
1 jumps found. (Code = 42) Position 1 = 110
Branch analysis from position: 110
2 jumps found. (Code = 43) Position 1 = 112, Position 2 = 127
Branch analysis from position: 112
2 jumps found. (Code = 77) Position 1 = 114, Position 2 = 126
Branch analysis from position: 114
2 jumps found. (Code = 78) Position 1 = 115, Position 2 = 126
Branch analysis from position: 115
1 jumps found. (Code = 42) Position 1 = 114
Branch analysis from position: 114
Branch analysis from position: 126
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 126
Branch analysis from position: 127
Branch analysis from position: 98
1 jumps found. (Code = 42) Position 1 = 110
Branch analysis from position: 110
Branch analysis from position: 103
2 jumps found. (Code = 46) Position 1 = 106, Position 2 = 107
Branch analysis from position: 106
2 jumps found. (Code = 43) Position 1 = 108, Position 2 = 110
Branch analysis from position: 108
2 jumps found. (Code = 43) Position 1 = 112, Position 2 = 127
Branch analysis from position: 112
Branch analysis from position: 127
Branch analysis from position: 110
Branch analysis from position: 107
Branch analysis from position: 85
Branch analysis from position: 76
2 jumps found. (Code = 46) Position 1 = 84, Position 2 = 85
Branch analysis from position: 84
Branch analysis from position: 85
Branch analysis from position: 81
Branch analysis from position: 70
Branch analysis from position: 65
Branch analysis from position: 66
Branch analysis from position: 51
Branch analysis from position: 52
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 37
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 52
Branch analysis from position: 40
Branch analysis from position: 52
Branch analysis from position: 37
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 30
Branch analysis from position: 25
Branch analysis from position: 30
filename:       /in/O3jvf
function name:  getpart
number of ops:  128
compiled vars:  !0 = $mbox, !1 = $mid, !2 = $p, !3 = $partno, !4 = $htmlmsg, !5 = $plainmsg, !6 = $charset, !7 = $attachments, !8 = $data, !9 = $params, !10 = $x, !11 = $filename, !12 = $p2, !13 = $partno0
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   23     4        BIND_GLOBAL                                              !4, 'htmlmsg'
          5        BIND_GLOBAL                                              !5, 'plainmsg'
          6        BIND_GLOBAL                                              !6, 'charset'
          7        BIND_GLOBAL                                              !7, 'attachments'
   25     8      > JMPZ                                                     !3, ->16
   26     9    >   INIT_FCALL_BY_NAME                                       'imap_fetchbody'
         10        SEND_VAR_EX                                              !0
         11        SEND_VAR_EX                                              !1
         12        SEND_VAR_EX                                              !3
         13        DO_FCALL                                      0  $14     
         14        QM_ASSIGN                                        ~15     $14
         15      > JMP                                                      ->21
   27    16    >   INIT_FCALL_BY_NAME                                       'imap_body'
         17        SEND_VAR_EX                                              !0
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0  $16     
         20        QM_ASSIGN                                        ~15     $16
   25    21    >   ASSIGN                                                   !8, ~15
   28    22        FETCH_OBJ_R                                      ~18     !2, 'encoding'
         23        IS_EQUAL                                                 ~18, 4
         24      > JMPZ                                                     ~19, ->30
   29    25    >   INIT_FCALL                                               'quoted_printable_decode'
         26        SEND_VAR                                                 !8
         27        DO_ICALL                                         $20     
         28        ASSIGN                                                   !8, $20
         29      > JMP                                                      ->37
   30    30    >   FETCH_OBJ_R                                      ~22     !2, 'encoding'
         31        IS_EQUAL                                                 ~22, 3
         32      > JMPZ                                                     ~23, ->37
   31    33    >   INIT_FCALL                                               'base64_decode'
         34        SEND_VAR                                                 !8
         35        DO_ICALL                                         $24     
         36        ASSIGN                                                   !8, $24
   33    37    >   ASSIGN                                                   !9, <array>
   34    38        FETCH_OBJ_R                                      ~27     !2, 'parameters'
         39      > JMPZ                                                     ~27, ->52
   35    40    >   FETCH_OBJ_R                                      ~28     !2, 'parameters'
         41      > FE_RESET_R                                       $29     ~28, ->51
         42    > > FE_FETCH_R                                               $29, !10, ->51
   36    43    >   INIT_FCALL                                               'strtolower'
         44        FETCH_OBJ_R                                      ~30     !10, 'attribute'
         45        SEND_VAL                                                 ~30
         46        DO_ICALL                                         $31     
         47        FETCH_OBJ_R                                      ~33     !10, 'value'
         48        ASSIGN_DIM                                               !9, $31
         49        OP_DATA                                                  ~33
   35    50      > JMP                                                      ->42
         51    >   FE_FREE                                                  $29
   37    52    >   FETCH_OBJ_R                                      ~34     !2, 'dparameters'
         53      > JMPZ                                                     ~34, ->66
   38    54    >   FETCH_OBJ_R                                      ~35     !2, 'dparameters'
         55      > FE_RESET_R                                       $36     ~35, ->65
         56    > > FE_FETCH_R                                               $36, !10, ->65
   39    57    >   INIT_FCALL                                               'strtolower'
         58        FETCH_OBJ_R                                      ~37     !10, 'attribute'
         59        SEND_VAL                                                 ~37
         60        DO_ICALL                                         $38     
         61        FETCH_OBJ_R                                      ~40     !10, 'value'
         62        ASSIGN_DIM                                               !9, $38
         63        OP_DATA                                                  ~40
   38    64      > JMP                                                      ->56
         65    >   FE_FREE                                                  $36
   41    66    >   FETCH_DIM_R                                      ~41     !9, 'filename'
         67      > JMPNZ_EX                                         ~41     ~41, ->70
         68    >   FETCH_DIM_R                                      ~42     !9, 'name'
         69        BOOL                                             ~41     ~42
         70    > > JMPZ                                                     ~41, ->81
   42    71    >   FETCH_DIM_R                                      ~43     !9, 'filename'
         72      > JMPZ                                                     ~43, ->76
         73    >   FETCH_DIM_R                                      ~44     !9, 'filename'
         74        QM_ASSIGN                                        ~45     ~44
         75      > JMP                                                      ->78
         76    >   FETCH_DIM_R                                      ~46     !9, 'name'
         77        QM_ASSIGN                                        ~45     ~46
         78    >   ASSIGN                                                   !11, ~45
   43    79        ASSIGN_DIM                                               !7, !11
         80        OP_DATA                                                  !8
   46    81    >   FETCH_OBJ_R                                      ~49     !2, 'type'
         82        IS_EQUAL                                         ~50     ~49, 0
         83      > JMPZ_EX                                          ~50     ~50, ->85
         84    >   BOOL                                             ~50     !8
         85    > > JMPZ                                                     ~50, ->103
   47    86    >   INIT_FCALL                                               'strtolower'
         87        FETCH_OBJ_R                                      ~51     !2, 'subtype'
         88        SEND_VAL                                                 ~51
         89        DO_ICALL                                         $52     
         90        IS_EQUAL                                                 $52, 'plain'
         91      > JMPZ                                                     ~53, ->98
   48    92    >   INIT_FCALL                                               'trim'
         93        SEND_VAR                                                 !8
         94        DO_ICALL                                         $54     
         95        CONCAT                                           ~55     $54, '%0A%0A'
         96        ASSIGN_OP                                     8          !5, ~55
         97      > JMP                                                      ->100
   50    98    >   CONCAT                                           ~57     !8, '%3Cbr%3E%3Cbr%3E'
         99        ASSIGN_OP                                     8          !4, ~57
   51   100    >   FETCH_DIM_R                                      ~59     !9, 'charset'
        101        ASSIGN                                                   !6, ~59
        102      > JMP                                                      ->110
   55   103    >   FETCH_OBJ_R                                      ~61     !2, 'type'
        104        IS_EQUAL                                         ~62     ~61, 2
        105      > JMPZ_EX                                          ~62     ~62, ->107
        106    >   BOOL                                             ~62     !8
        107    > > JMPZ                                                     ~62, ->110
   56   108    >   CONCAT                                           ~63     !8, '%0A%0A'
        109        ASSIGN_OP                                     8          !5, ~63
   59   110    >   FETCH_OBJ_R                                      ~65     !2, 'parts'
        111      > JMPZ                                                     ~65, ->127
   60   112    >   FETCH_OBJ_R                                      ~66     !2, 'parts'
        113      > FE_RESET_R                                       $67     ~66, ->126
        114    > > FE_FETCH_R                                       ~68     $67, !12, ->126
        115    >   ASSIGN                                                   !13, ~68
   61   116        INIT_FCALL_BY_NAME                                       'getpart'
        117        SEND_VAR_EX                                              !0
        118        SEND_VAR_EX                                              !1
        119        SEND_VAR_EX                                              !12
        120        CONCAT                                           ~70     !3, '.'
        121        ADD                                              ~71     !13, 1
        122        CONCAT                                           ~72     ~70, ~71
        123        SEND_VAL_EX                                              ~72
        124        DO_FCALL                                      0          
   60   125      > JMP                                                      ->114
        126    >   FE_FREE                                                  $67
   63   127    > > RETURN                                                   null

End of function getpart

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.16 ms | 1416 KiB | 21 Q