3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Content-Type: text/html; charset=utf-8"); function varInfo($display, $var) { echo '<b>==========' . $display . '===========</b><br />'; echo '<pre>'; var_dump($var); echo '</pre>'; } if (isset($_POST['submit'])) { $files = $_FILES['files']; $count = count($files['name']); $response = ''; for ($i = 0; $i < $count; $i++) { $name = $files['name'][$i]; $tmpName = $files['tmp_name'][$i]; $error = $files['error'][$i]; $size = $files['size'][$i]; $ext = strtolower(pathinfo($name, PATHINFO_EXTENSION)); if ($error == UPLOAD_ERR_OK) { $valid = true; //validate file extensions if ( $ext !== 'xls' ) { $valid = false; $response .= '<span style="color:red">' . $name . ':不是 xls 格式</span><br />'; } //validate file size if ( $size/1024/1024 > 2 ) { $valid = false; $response .= '<span style="color:red">' . $name . ':文件不允许超过 2M</span><br />'; } //upload file if ($valid) { if (!file_exists('uploads')) { mkdir('uploads'); } // fixing chinese charset problem in windows $name = iconv('utf-8', 'cp936', $name); $targetPath = dirname( __FILE__ ) . DIRECTORY_SEPARATOR. 'uploads' . DIRECTORY_SEPARATOR. $name; $response .= '上传成功: ' . $name . '<br />'; } } else { $response = '<span style="color:red">' . $name . ':上传失败</span><br />'; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>upload keywords files</title> </head> <body> <form enctype="multipart/form-data" action="" method="post"> Select a File:<br /> <input type="file" size="20" name="files[]" multiple /><br /> <input type="submit" name="submit" value="upload" /> </form> <?php if (!empty($response)) { ?> <p class="message"><?php echo $response; ?></p> <?php } ?> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 85
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
2 jumps found. (Code = 44) Position 1 = 85, Position 2 = 15
Branch analysis from position: 85
2 jumps found. (Code = 43) Position 1 = 89, Position 2 = 92
Branch analysis from position: 89
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 92
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 79
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 44
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 52
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 78
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 58, Position 2 = 61
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 82
Branch analysis from position: 82
2 jumps found. (Code = 44) Position 1 = 85, Position 2 = 15
Branch analysis from position: 85
Branch analysis from position: 15
Branch analysis from position: 61
Branch analysis from position: 78
Branch analysis from position: 52
Branch analysis from position: 44
Branch analysis from position: 79
2 jumps found. (Code = 44) Position 1 = 85, Position 2 = 15
Branch analysis from position: 85
Branch analysis from position: 15
Branch analysis from position: 85
filename:       /in/K86C7
function name:  (null)
number of ops:  94
compiled vars:  !0 = $files, !1 = $count, !2 = $response, !3 = $i, !4 = $name, !5 = $tmpName, !6 = $error, !7 = $size, !8 = $ext, !9 = $valid, !10 = $targetPath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'header'
          1        SEND_VAL                                                 'Content-Type%3A+text%2Fhtml%3B+charset%3Dutf-8'
          2        DO_ICALL                                                 
   11     3        FETCH_IS                                         ~12     '_POST'
          4        ISSET_ISEMPTY_DIM_OBJ                         0          ~12, 'submit'
          5      > JMPZ                                                     ~13, ->85
   12     6    >   FETCH_R                      global              ~14     '_FILES'
          7        FETCH_DIM_R                                      ~15     ~14, 'files'
          8        ASSIGN                                                   !0, ~15
   13     9        FETCH_DIM_R                                      ~17     !0, 'name'
         10        COUNT                                            ~18     ~17
         11        ASSIGN                                                   !1, ~18
   14    12        ASSIGN                                                   !2, ''
   16    13        ASSIGN                                                   !3, 0
         14      > JMP                                                      ->83
   17    15    >   FETCH_DIM_R                                      ~22     !0, 'name'
         16        FETCH_DIM_R                                      ~23     ~22, !3
         17        ASSIGN                                                   !4, ~23
   18    18        FETCH_DIM_R                                      ~25     !0, 'tmp_name'
         19        FETCH_DIM_R                                      ~26     ~25, !3
         20        ASSIGN                                                   !5, ~26
   19    21        FETCH_DIM_R                                      ~28     !0, 'error'
         22        FETCH_DIM_R                                      ~29     ~28, !3
         23        ASSIGN                                                   !6, ~29
   20    24        FETCH_DIM_R                                      ~31     !0, 'size'
         25        FETCH_DIM_R                                      ~32     ~31, !3
         26        ASSIGN                                                   !7, ~32
   21    27        INIT_FCALL                                               'strtolower'
         28        INIT_FCALL                                               'pathinfo'
         29        SEND_VAR                                                 !4
         30        SEND_VAL                                                 4
         31        DO_ICALL                                         $34     
         32        SEND_VAR                                                 $34
         33        DO_ICALL                                         $35     
         34        ASSIGN                                                   !8, $35
   23    35        IS_EQUAL                                                 !6, 0
         36      > JMPZ                                                     ~37, ->79
   24    37    >   ASSIGN                                                   !9, <true>
   26    38        IS_NOT_IDENTICAL                                         !8, 'xls'
         39      > JMPZ                                                     ~39, ->44
   27    40    >   ASSIGN                                                   !9, <false>
   28    41        CONCAT                                           ~41     '%3Cspan+style%3D%22color%3Ared%22%3E', !4
         42        CONCAT                                           ~42     ~41, '%3A%E4%B8%8D%E6%98%AF+xls+%E6%A0%BC%E5%BC%8F%3C%2Fspan%3E%3Cbr+%2F%3E'
         43        ASSIGN_OP                                     8          !2, ~42
   32    44    >   DIV                                              ~44     !7, 1024
         45        DIV                                              ~45     ~44, 1024
         46        IS_SMALLER                                               2, ~45
         47      > JMPZ                                                     ~46, ->52
   33    48    >   ASSIGN                                                   !9, <false>
   34    49        CONCAT                                           ~48     '%3Cspan+style%3D%22color%3Ared%22%3E', !4
         50        CONCAT                                           ~49     ~48, '%3A%E6%96%87%E4%BB%B6%E4%B8%8D%E5%85%81%E8%AE%B8%E8%B6%85%E8%BF%87+2M%3C%2Fspan%3E%3Cbr+%2F%3E'
         51        ASSIGN_OP                                     8          !2, ~49
   38    52    > > JMPZ                                                     !9, ->78
   39    53    >   INIT_FCALL                                               'file_exists'
         54        SEND_VAL                                                 'uploads'
         55        DO_ICALL                                         $51     
         56        BOOL_NOT                                         ~52     $51
         57      > JMPZ                                                     ~52, ->61
   40    58    >   INIT_FCALL                                               'mkdir'
         59        SEND_VAL                                                 'uploads'
         60        DO_ICALL                                                 
   44    61    >   INIT_FCALL_BY_NAME                                       'iconv'
         62        SEND_VAL_EX                                              'utf-8'
         63        SEND_VAL_EX                                              'cp936'
         64        SEND_VAR_EX                                              !4
         65        DO_FCALL                                      0  $54     
         66        ASSIGN                                                   !4, $54
   45    67        INIT_FCALL                                               'dirname'
         68        SEND_VAL                                                 '%2Fin%2FK86C7'
         69        DO_ICALL                                         $56     
         70        CONCAT                                           ~57     $56, '%2F'
         71        CONCAT                                           ~58     ~57, 'uploads'
         72        CONCAT                                           ~59     ~58, '%2F'
         73        CONCAT                                           ~60     ~59, !4
         74        ASSIGN                                                   !10, ~60
   46    75        CONCAT                                           ~62     '%E4%B8%8A%E4%BC%A0%E6%88%90%E5%8A%9F%3A+', !4
         76        CONCAT                                           ~63     ~62, '%3Cbr+%2F%3E'
         77        ASSIGN_OP                                     8          !2, ~63
         78    > > JMP                                                      ->82
   49    79    >   CONCAT                                           ~65     '%3Cspan+style%3D%22color%3Ared%22%3E', !4
         80        CONCAT                                           ~66     ~65, '%3A%E4%B8%8A%E4%BC%A0%E5%A4%B1%E8%B4%A5%3C%2Fspan%3E%3Cbr+%2F%3E'
         81        ASSIGN                                                   !2, ~66
   16    82    >   PRE_INC                                                  !3
         83    >   IS_SMALLER                                               !3, !1
         84      > JMPNZ                                                    ~69, ->15
   56    85    >   ECHO                                                     '%0A+%3C%21DOCTYPE+html%3E%0A+%3Chtml+lang%3D%22en%22%3E%0A+%3Chead%3E%0A+%09%3Cmeta+charset%3D%22UTF-8%22%3E%0A+%09%3Ctitle%3Eupload+keywords+files%3C%2Ftitle%3E%0A+%3C%2Fhead%3E%0A+%3Cbody%3E%0A+%3Cform+enctype%3D%22multipart%2Fform-data%22+action%3D%22%22+method%3D%22post%22%3E%0A+%09Select+a+File%3A%3Cbr+%2F%3E%0A+%09%3Cinput+type%3D%22file%22+size%3D%2220%22+name%3D%22files%5B%5D%22+multiple+%2F%3E%3Cbr+%2F%3E%0A+%09%3Cinput+type%3D%22submit%22+name%3D%22submit%22+value%3D%22upload%22+%2F%3E%0A+%09%3C%2Fform%3E%0A+%09'
   69    86        ISSET_ISEMPTY_CV                                 ~70     !2
         87        BOOL_NOT                                         ~71     ~70
         88      > JMPZ                                                     ~71, ->92
   70    89    >   ECHO                                                     '+%09%3Cp+class%3D%22message%22%3E'
         90        ECHO                                                     !2
         91        ECHO                                                     '%3C%2Fp%3E%0A+%09'
   72    92    >   ECHO                                                     '+%3C%2Fbody%3E%0A+%3C%2Fhtml%3E'
   73    93      > RETURN                                                   1

Function varinfo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K86C7
function name:  varInfo
number of ops:  11
compiled vars:  !0 = $display, !1 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        CONCAT                                           ~2      '%3Cb%3E%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D', !0
          3        CONCAT                                           ~3      ~2, '%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3C%2Fb%3E%3Cbr+%2F%3E'
          4        ECHO                                                     ~3
    6     5        ECHO                                                     '%3Cpre%3E'
    7     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
    8     9        ECHO                                                     '%3C%2Fpre%3E'
    9    10      > RETURN                                                   null

End of function varinfo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.81 ms | 1404 KiB | 27 Q