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) ?: []; $map = array_flip($headers); $result = []; while (($values = fgetcsv($handle)) !== 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 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 24
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 34
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 34
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 24
Branch analysis from position: 43
Branch analysis from position: 24
Branch analysis from position: 34
filename:       /in/B18lQ
function name:  (null)
number of ops:  50
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        DO_ICALL                                         $15     
         15        JMP_SET                                          ~16     $15, ->17
         16        QM_ASSIGN                                        ~16     <array>
         17        ASSIGN                                                   !3, ~16
   34    18        INIT_FCALL                                               'array_flip'
         19        SEND_VAR                                                 !3
         20        DO_ICALL                                         $18     
         21        ASSIGN                                                   !4, $18
   36    22        ASSIGN                                                   !5, <array>
   37    23      > JMP                                                      ->37
   38    24    >   ASSIGN                                                   !6, <array>
   39    25      > FE_RESET_R                                       $22     !2, ->34
         26    > > FE_FETCH_R                                               $22, !7, ->34
   40    27    >   FETCH_DIM_R                                      ~24     !4, !7
         28        FETCH_DIM_IS                                     ~25     !8, ~24
         29        COALESCE                                         ~26     ~25
         30        QM_ASSIGN                                        ~26     null
         31        ASSIGN_DIM                                               !6, !7
         32        OP_DATA                                                  ~26
   39    33      > JMP                                                      ->26
         34    >   FE_FREE                                                  $22
   42    35        ASSIGN_DIM                                               !5
         36        OP_DATA                                                  !6
   37    37    >   INIT_FCALL                                               'fgetcsv'
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                         $28     
         40        ASSIGN                                           ~29     !8, $28
         41        TYPE_CHECK                                  1018          ~29
         42      > JMPNZ                                                    ~30, ->24
   44    43    >   INIT_FCALL                                               'fclose'
         44        SEND_VAR                                                 !1
         45        DO_ICALL                                                 
   45    46        INIT_FCALL                                               'var_export'
         47        SEND_VAR                                                 !5
         48        DO_ICALL                                                 
         49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.89 ms | 1009 KiB | 20 Q