3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(isset($_POST['submit'])) { //Connect to Database $db = new PDO('mysql:host=localhost;dbname=dbname;charset=utf8', 'dbuser', 'dbpassword'); //Upload File if (is_uploaded_file($_FILES['filename']['tmp_name'])) { echo "<h2>" . "File ". $_FILES['filename']['name'] ." uploaded successfully." . "</h2>"; } //Import uploaded file to Database $handle = fopen($_FILES['filename']['tmp_name'], "r"); $count =0; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $import = $db->exec("INSERT into seoreports (account_name,ranking,alerts,opportunities,pdf_report) values('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]')"); $count++; } fclose($handle); //Print interted rows $msg="<h3 style='color:green;'>".$count. "&nbsp;&nbsp;Rows Imported !</h3>"; } ?> - See more at: http://freewebmentor.com/2014/01/import-csv-file-data-in-mysql.html#sthash.F1Ja1JeG.dpuf
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 68
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 54
Branch analysis from position: 54
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 33
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 62, Position 2 = 33
Branch analysis from position: 62
Branch analysis from position: 33
Branch analysis from position: 23
Branch analysis from position: 68
filename:       /in/SUVJt
function name:  (null)
number of ops:  70
compiled vars:  !0 = $db, !1 = $handle, !2 = $count, !3 = $import, !4 = $data, !5 = $msg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_IS                                         ~6      '_POST'
          1        ISSET_ISEMPTY_DIM_OBJ                         0          ~6, 'submit'
          2      > JMPZ                                                     ~7, ->68
    5     3    >   NEW                                              $8      'PDO'
          4        SEND_VAL_EX                                              'mysql%3Ahost%3Dlocalhost%3Bdbname%3Ddbname%3Bcharset%3Dutf8'
    6     5        SEND_VAL_EX                                              'dbuser'
          6        SEND_VAL_EX                                              'dbpassword'
          7        DO_FCALL                                      0          
    5     8        ASSIGN                                                   !0, $8
    9     9        INIT_FCALL                                               'is_uploaded_file'
         10        FETCH_R                      global              ~11     '_FILES'
         11        FETCH_DIM_R                                      ~12     ~11, 'filename'
         12        FETCH_DIM_R                                      ~13     ~12, 'tmp_name'
         13        SEND_VAL                                                 ~13
         14        DO_ICALL                                         $14     
         15      > JMPZ                                                     $14, ->23
   11    16    >   FETCH_R                      global              ~15     '_FILES'
         17        FETCH_DIM_R                                      ~16     ~15, 'filename'
         18        FETCH_DIM_R                                      ~17     ~16, 'name'
         19        CONCAT                                           ~18     '%3Ch2%3EFile+', ~17
   12    20        CONCAT                                           ~19     ~18, '+uploaded+successfully.'
         21        CONCAT                                           ~20     ~19, '%3C%2Fh2%3E'
         22        ECHO                                                     ~20
   16    23    >   INIT_FCALL                                               'fopen'
         24        FETCH_R                      global              ~21     '_FILES'
         25        FETCH_DIM_R                                      ~22     ~21, 'filename'
         26        FETCH_DIM_R                                      ~23     ~22, 'tmp_name'
         27        SEND_VAL                                                 ~23
         28        SEND_VAL                                                 'r'
         29        DO_ICALL                                         $24     
         30        ASSIGN                                                   !1, $24
   17    31        ASSIGN                                                   !2, 0
   19    32      > JMP                                                      ->54
   20    33    >   INIT_METHOD_CALL                                         !0, 'exec'
         34        ROPE_INIT                                    11  ~33     'INSERT+into++seoreports%0A%28account_name%2Cranking%2Calerts%2Copportunities%2Cpdf_report%29%0Avalues%28%27'
   22    35        FETCH_DIM_R                                      ~27     !4, 0
         36        ROPE_ADD                                      1  ~33     ~33, ~27
         37        ROPE_ADD                                      2  ~33     ~33, '%27%2C%27'
         38        FETCH_DIM_R                                      ~28     !4, 1
         39        ROPE_ADD                                      3  ~33     ~33, ~28
         40        ROPE_ADD                                      4  ~33     ~33, '%27%2C%27'
         41        FETCH_DIM_R                                      ~29     !4, 2
         42        ROPE_ADD                                      5  ~33     ~33, ~29
         43        ROPE_ADD                                      6  ~33     ~33, '%27%2C%27'
         44        FETCH_DIM_R                                      ~30     !4, 3
         45        ROPE_ADD                                      7  ~33     ~33, ~30
         46        ROPE_ADD                                      8  ~33     ~33, '%27%2C%27'
         47        FETCH_DIM_R                                      ~31     !4, 4
         48        ROPE_ADD                                      9  ~33     ~33, ~31
         49        ROPE_END                                     10  ~32     ~33, '%27%29'
         50        SEND_VAL_EX                                              ~32
         51        DO_FCALL                                      0  $39     
   20    52        ASSIGN                                                   !3, $39
   24    53        PRE_INC                                                  !2
   19    54    >   INIT_FCALL                                               'fgetcsv'
         55        SEND_VAR                                                 !1
         56        SEND_VAL                                                 1000
         57        SEND_VAL                                                 '%2C'
         58        DO_ICALL                                         $42     
         59        ASSIGN                                           ~43     !4, $42
         60        TYPE_CHECK                                  1018          ~43
         61      > JMPNZ                                                    ~44, ->33
   27    62    >   INIT_FCALL                                               'fclose'
         63        SEND_VAR                                                 !1
         64        DO_ICALL                                                 
   30    65        CONCAT                                           ~46     '%3Ch3+style%3D%27color%3Agreen%3B%27%3E', !2
   31    66        CONCAT                                           ~47     ~46, '%26nbsp%3B%26nbsp%3BRows+Imported+%21%3C%2Fh3%3E'
   30    67        ASSIGN                                                   !5, ~47
   35    68    >   ECHO                                                     '-+See+more+at%3A+http%3A%2F%2Ffreewebmentor.com%2F2014%2F01%2Fimport-csv-file-data-in-mysql.html%23sthash.F1Ja1JeG.dpuf'
         69      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.11 ms | 1400 KiB | 21 Q