3v4l.org

run code in 300+ PHP versions simultaneously
<?php $csv = <<<CSV "Price","Bogus","Symbol","Description","Qty (Quantity)","Price Chng % (Price Change %)","Price Chng $ (Price Change $)","Day Chng % (Day Change %)","Day Chng $ (Day Change $)","Cost Basis","Gain % (Gain/Loss %)","Gain $ (Gain/Loss $)","Reinvest?","Reinvest Capital Gains?","Last Div (Last Dividend)","Volume","Security Type" "$19.39","foo1","Test1","ETF","820","-2.42%","-$0.48","-2.42%","-$393.6","$601.73","-18.89%","-$3701.93","No","--","$0.72025","14,626,464","ETFs & Closed End Funds" "$49.43","foo2","Test2"," ETF","110","-2.39%","-$1.21","-2.39%","-$133.1","$995.2","-9.31%","-$557.9","Yes","--","N/A","59,351,095","ETFs & Closed End Funds" "$21.77","foo3","Test3"," ETF","760","-3.72%","-$0.84","-3.72%","-$638.4","$687.73","-20.02%","-$142.53","No","--","$2.0216","6,402,084","ETFs & Closed End Funds" CSV; $handle = tmpfile(); fwrite($handle, $csv); rewind($handle); $whitelist = [ "Symbol", "Description", "Qty (Quantity)", "Price", "Price Chng % (Price Change %)", "Price Chng $ (Price Change $)", "Day Chng % (Day Change %)", "Day Chng $ (Day Change $)", "Cost Basis", "Gain % (Gain/Loss %)", "Gain $ (Gain/Loss $)", "Reinvest?", "Reinvest Capital Gains?", "Last Div (Last Dividend)", "Volume", "Security Type" ]; $headers = fgetcsv($handle, null, ',', '"', '') ?: []; $map = array_flip($headers); $result = []; while (($values = fgetcsv($handle, null, ',', '"', '')) !== false) { $row = []; foreach ($whitelist as $col) { $row[$col] = $values[$map[$col]] ?? null; } $result[] = $row; } fclose($handle); var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 28
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 30, Position 2 = 38
Branch analysis from position: 30
2 jumps found. (Code = 78) Position 1 = 31, Position 2 = 38
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 28
Branch analysis from position: 51
Branch analysis from position: 28
Branch analysis from position: 38
filename:       /in/DFMRo
function name:  (null)
number of ops:  58
compiled vars:  !0 = $csv, !1 = $handle, !2 = $whitelist, !3 = $headers, !4 = $map, !5 = $result, !6 = $row, !7 = $col, !8 = $values
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%22Price%22%2C%22Bogus%22%2C%22Symbol%22%2C%22Description%22%2C%22Qty+%28Quantity%29%22%2C%22Price+Chng+%25+%28Price+Change+%25%29%22%2C%22Price+Chng+%24+%28Price+Change+%24%29%22%2C%22Day+Chng+%25+%28Day+Change+%25%29%22%2C%22Day+Chng+%24+%28Day+Change+%24%29%22%2C%22Cost+Basis%22%2C%22Gain+%25+%28Gain%2FLoss+%25%29%22%2C%22Gain+%24+%28Gain%2FLoss+%24%29%22%2C%22Reinvest%3F%22%2C%22Reinvest+Capital+Gains%3F%22%2C%22Last+Div+%28Last+Dividend%29%22%2C%22Volume%22%2C%22Security+Type%22%0A%22%2419.39%22%2C%22foo1%22%2C%22Test1%22%2C%22ETF%22%2C%22820%22%2C%22-2.42%25%22%2C%22-%240.48%22%2C%22-2.42%25%22%2C%22-%24393.6%22%2C%22%24601.73%22%2C%22-18.89%25%22%2C%22-%243701.93%22%2C%22No%22%2C%22--%22%2C%22%240.72025%22%2C%2214%2C626%2C464%22%2C%22ETFs+%26+Closed+End+Funds%22%0A%22%2449.43%22%2C%22foo2%22%2C%22Test2%22%2C%22+ETF%22%2C%22110%22%2C%22-2.39%25%22%2C%22-%241.21%22%2C%22-2.39%25%22%2C%22-%24133.1%22%2C%22%24995.2%22%2C%22-9.31%25%22%2C%22-%24557.9%22%2C%22Yes%22%2C%22--%22%2C%22N%2FA%22%2C%2259%2C351%2C095%22%2C%22ETFs+%26+Closed+End+Funds%22%0A%22%2421.77%22%2C%22foo3%22%2C%22Test3%22%2C%22+ETF%22%2C%22760%22%2C%22-3.72%25%22%2C%22-%240.84%22%2C%22-3.72%25%22%2C%22-%24638.4%22%2C%22%24687.73%22%2C%22-20.02%25%22%2C%22-%24142.53%22%2C%22No%22%2C%22--%22%2C%22%242.0216%22%2C%226%2C402%2C084%22%2C%22ETFs+%26+Closed+End+Funds%22'
   10     1        INIT_FCALL                                               'tmpfile'
          2        DO_ICALL                                         $10     
          3        ASSIGN                                                   !1, $10
   11     4        INIT_FCALL                                               'fwrite'
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   12     8        INIT_FCALL                                               'rewind'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
   14    11        ASSIGN                                                   !2, <array>
   33    12        INIT_FCALL                                               'fgetcsv'
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 null
         15        SEND_VAL                                                 '%2C'
         16        SEND_VAL                                                 '%22'
         17        SEND_VAL                                                 ''
         18        DO_ICALL                                         $15     
         19        JMP_SET                                          ~16     $15, ->21
         20        QM_ASSIGN                                        ~16     <array>
         21        ASSIGN                                                   !3, ~16
   34    22        INIT_FCALL                                               'array_flip'
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                         $18     
         25        ASSIGN                                                   !4, $18
   36    26        ASSIGN                                                   !5, <array>
   37    27      > JMP                                                      ->41
   38    28    >   ASSIGN                                                   !6, <array>
   39    29      > FE_RESET_R                                       $22     !2, ->38
         30    > > FE_FETCH_R                                               $22, !7, ->38
   40    31    >   FETCH_DIM_R                                      ~24     !4, !7
         32        FETCH_DIM_IS                                     ~25     !8, ~24
         33        COALESCE                                         ~26     ~25
         34        QM_ASSIGN                                        ~26     null
         35        ASSIGN_DIM                                               !6, !7
         36        OP_DATA                                                  ~26
   39    37      > JMP                                                      ->30
         38    >   FE_FREE                                                  $22
   42    39        ASSIGN_DIM                                               !5
         40        OP_DATA                                                  !6
   37    41    >   INIT_FCALL                                               'fgetcsv'
         42        SEND_VAR                                                 !1
         43        SEND_VAL                                                 null
         44        SEND_VAL                                                 '%2C'
         45        SEND_VAL                                                 '%22'
         46        SEND_VAL                                                 ''
         47        DO_ICALL                                         $28     
         48        ASSIGN                                           ~29     !8, $28
         49        TYPE_CHECK                                  1018          ~29
         50      > JMPNZ                                                    ~30, ->28
   44    51    >   INIT_FCALL                                               'fclose'
         52        SEND_VAR                                                 !1
         53        DO_ICALL                                                 
   45    54        INIT_FCALL                                               'var_export'
         55        SEND_VAR                                                 !5
         56        DO_ICALL                                                 
         57      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.98 ms | 1009 KiB | 20 Q