3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Content-Type: text/html; charset=utf-8"); if (isset($_POST['submit'])) { $files = $_FILES['files']; $count = count($files['name']); 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; } } else { $response = '<span style="color:red">' . $name . ':upload failed</span><br />'; } echo $error; } } ?> <!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> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 82
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
2 jumps found. (Code = 44) Position 1 = 82, Position 2 = 14
Branch analysis from position: 82
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 75
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 43
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 51
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 74
Branch analysis from position: 52
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 60
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
2 jumps found. (Code = 44) Position 1 = 82, Position 2 = 14
Branch analysis from position: 82
Branch analysis from position: 14
Branch analysis from position: 60
Branch analysis from position: 74
Branch analysis from position: 51
Branch analysis from position: 43
Branch analysis from position: 75
2 jumps found. (Code = 44) Position 1 = 82, Position 2 = 14
Branch analysis from position: 82
Branch analysis from position: 14
Branch analysis from position: 82
filename:       /in/inZCY
function name:  (null)
number of ops:  84
compiled vars:  !0 = $files, !1 = $count, !2 = $i, !3 = $name, !4 = $tmpName, !5 = $error, !6 = $size, !7 = $ext, !8 = $valid, !9 = $response, !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                                                 
    4     3        FETCH_IS                                         ~12     '_POST'
          4        ISSET_ISEMPTY_DIM_OBJ                         0          ~12, 'submit'
          5      > JMPZ                                                     ~13, ->82
    5     6    >   FETCH_R                      global              ~14     '_FILES'
          7        FETCH_DIM_R                                      ~15     ~14, 'files'
          8        ASSIGN                                                   !0, ~15
    6     9        FETCH_DIM_R                                      ~17     !0, 'name'
         10        COUNT                                            ~18     ~17
         11        ASSIGN                                                   !1, ~18
    8    12        ASSIGN                                                   !2, 0
         13      > JMP                                                      ->80
    9    14    >   FETCH_DIM_R                                      ~21     !0, 'name'
         15        FETCH_DIM_R                                      ~22     ~21, !2
         16        ASSIGN                                                   !3, ~22
   10    17        FETCH_DIM_R                                      ~24     !0, 'tmp_name'
         18        FETCH_DIM_R                                      ~25     ~24, !2
         19        ASSIGN                                                   !4, ~25
   11    20        FETCH_DIM_R                                      ~27     !0, 'error'
         21        FETCH_DIM_R                                      ~28     ~27, !2
         22        ASSIGN                                                   !5, ~28
   12    23        FETCH_DIM_R                                      ~30     !0, 'size'
         24        FETCH_DIM_R                                      ~31     ~30, !2
         25        ASSIGN                                                   !6, ~31
   13    26        INIT_FCALL                                               'strtolower'
         27        INIT_FCALL                                               'pathinfo'
         28        SEND_VAR                                                 !3
         29        SEND_VAL                                                 4
         30        DO_ICALL                                         $33     
         31        SEND_VAR                                                 $33
         32        DO_ICALL                                         $34     
         33        ASSIGN                                                   !7, $34
   16    34        IS_EQUAL                                                 !5, 0
         35      > JMPZ                                                     ~36, ->75
   17    36    >   ASSIGN                                                   !8, <true>
   19    37        IS_NOT_IDENTICAL                                         !7, 'xls'
         38      > JMPZ                                                     ~38, ->43
   20    39    >   ASSIGN                                                   !8, <false>
   21    40        CONCAT                                           ~40     '%3Cspan+style%3D%22color%3Ared%22%3E', !3
         41        CONCAT                                           ~41     ~40, '%3A%E4%B8%8D%E6%98%AF+xls+%E6%A0%BC%E5%BC%8F%3C%2Fspan%3E%3Cbr+%2F%3E'
         42        ASSIGN                                                   !9, ~41
   25    43    >   DIV                                              ~43     !6, 1024
         44        DIV                                              ~44     ~43, 1024
         45        IS_SMALLER                                               2, ~44
         46      > JMPZ                                                     ~45, ->51
   26    47    >   ASSIGN                                                   !8, <false>
   27    48        CONCAT                                           ~47     '%3Cspan+style%3D%22color%3Ared%22%3E', !3
         49        CONCAT                                           ~48     ~47, '%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'
         50        ASSIGN                                                   !9, ~48
   31    51    > > JMPZ                                                     !8, ->74
   32    52    >   INIT_FCALL                                               'file_exists'
         53        SEND_VAL                                                 'uploads'
         54        DO_ICALL                                         $50     
         55        BOOL_NOT                                         ~51     $50
         56      > JMPZ                                                     ~51, ->60
   33    57    >   INIT_FCALL                                               'mkdir'
         58        SEND_VAL                                                 'uploads'
         59        DO_ICALL                                                 
   37    60    >   INIT_FCALL_BY_NAME                                       'iconv'
         61        SEND_VAL_EX                                              'utf-8'
         62        SEND_VAL_EX                                              'cp936'
         63        SEND_VAR_EX                                              !3
         64        DO_FCALL                                      0  $53     
         65        ASSIGN                                                   !3, $53
   38    66        INIT_FCALL                                               'dirname'
         67        SEND_VAL                                                 '%2Fin%2FinZCY'
         68        DO_ICALL                                         $55     
         69        CONCAT                                           ~56     $55, '%2F'
         70        CONCAT                                           ~57     ~56, 'uploads'
         71        CONCAT                                           ~58     ~57, '%2F'
         72        CONCAT                                           ~59     ~58, !3
         73        ASSIGN                                                   !10, ~59
         74    > > JMP                                                      ->78
   41    75    >   CONCAT                                           ~61     '%3Cspan+style%3D%22color%3Ared%22%3E', !3
         76        CONCAT                                           ~62     ~61, '%3Aupload+failed%3C%2Fspan%3E%3Cbr+%2F%3E'
         77        ASSIGN                                                   !9, ~62
   44    78    >   ECHO                                                     !5
    8    79        PRE_INC                                                  !2
         80    >   IS_SMALLER                                               !2, !1
         81      > JMPNZ                                                    ~65, ->14
   51    82    >   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+%3C%2Fbody%3E%0A+%3C%2Fhtml%3E'
   65    83      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183 ms | 1404 KiB | 25 Q