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'])) { varInfo('files', $_FILES['files']); $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)); varInfo('name', $name); varInfo('tmpName', $tmpName); varInfo('error', $error); varInfo('size', $size); varInfo('ext', $ext); varInfo('upload err ok', UPLOAD_ERR_OK); 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; varInfo('tmpName', $tmpName); varInfo('target', $targetPath); varInfo('result', move_uploaded_file($tmpName,$targetPath)); } } else { $response = '<span style="color:red">' . $name . ':上传失败</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 = 128
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 126
Branch analysis from position: 126
2 jumps found. (Code = 44) Position 1 = 128, Position 2 = 20
Branch analysis from position: 128
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 121
Branch analysis from position: 66
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 73
Branch analysis from position: 69
2 jumps found. (Code = 43) Position 1 = 77, Position 2 = 81
Branch analysis from position: 77
2 jumps found. (Code = 43) Position 1 = 82, Position 2 = 120
Branch analysis from position: 82
2 jumps found. (Code = 43) Position 1 = 87, Position 2 = 90
Branch analysis from position: 87
1 jumps found. (Code = 42) Position 1 = 124
Branch analysis from position: 124
2 jumps found. (Code = 44) Position 1 = 128, Position 2 = 20
Branch analysis from position: 128
Branch analysis from position: 20
Branch analysis from position: 90
Branch analysis from position: 120
Branch analysis from position: 81
Branch analysis from position: 73
Branch analysis from position: 121
2 jumps found. (Code = 44) Position 1 = 128, Position 2 = 20
Branch analysis from position: 128
Branch analysis from position: 20
Branch analysis from position: 128
filename:       /in/f8rlt
function name:  (null)
number of ops:  130
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                                                 
   11     3        FETCH_IS                                         ~12     '_POST'
          4        ISSET_ISEMPTY_DIM_OBJ                         0          ~12, 'submit'
          5      > JMPZ                                                     ~13, ->128
   12     6    >   INIT_FCALL                                               'varinfo'
          7        SEND_VAL                                                 'files'
          8        FETCH_R                      global              ~14     '_FILES'
          9        FETCH_DIM_R                                      ~15     ~14, 'files'
         10        SEND_VAL                                                 ~15
         11        DO_FCALL                                      0          
   14    12        FETCH_R                      global              ~17     '_FILES'
         13        FETCH_DIM_R                                      ~18     ~17, 'files'
         14        ASSIGN                                                   !0, ~18
   15    15        FETCH_DIM_R                                      ~20     !0, 'name'
         16        COUNT                                            ~21     ~20
         17        ASSIGN                                                   !1, ~21
   17    18        ASSIGN                                                   !2, 0
         19      > JMP                                                      ->126
   18    20    >   FETCH_DIM_R                                      ~24     !0, 'name'
         21        FETCH_DIM_R                                      ~25     ~24, !2
         22        ASSIGN                                                   !3, ~25
   19    23        FETCH_DIM_R                                      ~27     !0, 'tmp_name'
         24        FETCH_DIM_R                                      ~28     ~27, !2
         25        ASSIGN                                                   !4, ~28
   20    26        FETCH_DIM_R                                      ~30     !0, 'error'
         27        FETCH_DIM_R                                      ~31     ~30, !2
         28        ASSIGN                                                   !5, ~31
   21    29        FETCH_DIM_R                                      ~33     !0, 'size'
         30        FETCH_DIM_R                                      ~34     ~33, !2
         31        ASSIGN                                                   !6, ~34
   22    32        INIT_FCALL                                               'strtolower'
         33        INIT_FCALL                                               'pathinfo'
         34        SEND_VAR                                                 !3
         35        SEND_VAL                                                 4
         36        DO_ICALL                                         $36     
         37        SEND_VAR                                                 $36
         38        DO_ICALL                                         $37     
         39        ASSIGN                                                   !7, $37
   24    40        INIT_FCALL                                               'varinfo'
         41        SEND_VAL                                                 'name'
         42        SEND_VAR                                                 !3
         43        DO_FCALL                                      0          
   25    44        INIT_FCALL                                               'varinfo'
         45        SEND_VAL                                                 'tmpName'
         46        SEND_VAR                                                 !4
         47        DO_FCALL                                      0          
   26    48        INIT_FCALL                                               'varinfo'
         49        SEND_VAL                                                 'error'
         50        SEND_VAR                                                 !5
         51        DO_FCALL                                      0          
   27    52        INIT_FCALL                                               'varinfo'
         53        SEND_VAL                                                 'size'
         54        SEND_VAR                                                 !6
         55        DO_FCALL                                      0          
   28    56        INIT_FCALL                                               'varinfo'
         57        SEND_VAL                                                 'ext'
         58        SEND_VAR                                                 !7
         59        DO_FCALL                                      0          
   30    60        INIT_FCALL                                               'varinfo'
         61        SEND_VAL                                                 'upload+err+ok'
         62        SEND_VAL                                                 0
         63        DO_FCALL                                      0          
   31    64        IS_EQUAL                                                 !5, 0
         65      > JMPZ                                                     ~45, ->121
   32    66    >   ASSIGN                                                   !8, <true>
   34    67        IS_NOT_IDENTICAL                                         !7, 'xls'
         68      > JMPZ                                                     ~47, ->73
   35    69    >   ASSIGN                                                   !8, <false>
   36    70        CONCAT                                           ~49     '%3Cspan+style%3D%22color%3Ared%22%3E', !3
         71        CONCAT                                           ~50     ~49, '%3A%E4%B8%8D%E6%98%AF+xls+%E6%A0%BC%E5%BC%8F%3C%2Fspan%3E%3Cbr+%2F%3E'
         72        ASSIGN                                                   !9, ~50
   40    73    >   DIV                                              ~52     !6, 1024
         74        DIV                                              ~53     ~52, 1024
         75        IS_SMALLER                                               2, ~53
         76      > JMPZ                                                     ~54, ->81
   41    77    >   ASSIGN                                                   !8, <false>
   42    78        CONCAT                                           ~56     '%3Cspan+style%3D%22color%3Ared%22%3E', !3
         79        CONCAT                                           ~57     ~56, '%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'
         80        ASSIGN                                                   !9, ~57
   46    81    > > JMPZ                                                     !8, ->120
   47    82    >   INIT_FCALL                                               'file_exists'
         83        SEND_VAL                                                 'uploads'
         84        DO_ICALL                                         $59     
         85        BOOL_NOT                                         ~60     $59
         86      > JMPZ                                                     ~60, ->90
   48    87    >   INIT_FCALL                                               'mkdir'
         88        SEND_VAL                                                 'uploads'
         89        DO_ICALL                                                 
   52    90    >   INIT_FCALL_BY_NAME                                       'iconv'
         91        SEND_VAL_EX                                              'utf-8'
         92        SEND_VAL_EX                                              'cp936'
         93        SEND_VAR_EX                                              !3
         94        DO_FCALL                                      0  $62     
         95        ASSIGN                                                   !3, $62
   53    96        INIT_FCALL                                               'dirname'
         97        SEND_VAL                                                 '%2Fin%2Ff8rlt'
         98        DO_ICALL                                         $64     
         99        CONCAT                                           ~65     $64, '%2F'
        100        CONCAT                                           ~66     ~65, 'uploads'
        101        CONCAT                                           ~67     ~66, '%2F'
        102        CONCAT                                           ~68     ~67, !3
        103        ASSIGN                                                   !10, ~68
   54   104        INIT_FCALL                                               'varinfo'
        105        SEND_VAL                                                 'tmpName'
        106        SEND_VAR                                                 !4
        107        DO_FCALL                                      0          
   55   108        INIT_FCALL                                               'varinfo'
        109        SEND_VAL                                                 'target'
        110        SEND_VAR                                                 !10
        111        DO_FCALL                                      0          
   56   112        INIT_FCALL                                               'varinfo'
        113        SEND_VAL                                                 'result'
        114        INIT_FCALL                                               'move_uploaded_file'
        115        SEND_VAR                                                 !4
        116        SEND_VAR                                                 !10
        117        DO_ICALL                                         $72     
        118        SEND_VAR                                                 $72
        119        DO_FCALL                                      0          
        120    > > JMP                                                      ->124
   59   121    >   CONCAT                                           ~74     '%3Cspan+style%3D%22color%3Ared%22%3E', !3
        122        CONCAT                                           ~75     ~74, '%3A%E4%B8%8A%E4%BC%A0%E5%A4%B1%E8%B4%A5%3C%2Fspan%3E%3Cbr+%2F%3E'
        123        ASSIGN                                                   !9, ~75
   62   124    >   ECHO                                                     !5
   17   125        PRE_INC                                                  !2
        126    >   IS_SMALLER                                               !2, !1
        127      > JMPNZ                                                    ~78, ->20
   69   128    >   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'
   83   129      > RETURN                                                   1

Function varinfo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f8rlt
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:
174.28 ms | 1410 KiB | 39 Q