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 = array( "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); if ($headers) { $map = array_flip($headers); } $result = array(); while (($values = fgetcsv($handle)) !== false) { $row = array(); foreach ($whitelist as $col) { $row[$col] = isset($map[$col],$values[$map[$col]]) ? $values[$map[$col]] : null; } $result[] = $row; } fclose($handle); var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 23
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 40
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 40
Branch analysis from position: 26
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 31
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 31
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 23
Branch analysis from position: 49
Branch analysis from position: 23
Branch analysis from position: 40
Branch analysis from position: 21
filename:       /in/1fLgs
function name:  (null)
number of ops:  56
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        ASSIGN                                                   !3, $15
   34    16      > JMPZ                                                     !3, ->21
   35    17    >   INIT_FCALL                                               'array_flip'
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $17     
         20        ASSIGN                                                   !4, $17
   38    21    >   ASSIGN                                                   !5, <array>
   39    22      > JMP                                                      ->43
   40    23    >   ASSIGN                                                   !6, <array>
   41    24      > FE_RESET_R                                       $21     !2, ->40
         25    > > FE_FETCH_R                                               $21, !7, ->40
   42    26    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~23     !4, !7
         27      > JMPZ_EX                                          ~23     ~23, ->31
         28    >   FETCH_DIM_R                                      ~24     !4, !7
         29        ISSET_ISEMPTY_DIM_OBJ                         0  ~25     !8, ~24
         30        BOOL                                             ~23     ~25
         31    > > JMPZ                                                     ~23, ->36
         32    >   FETCH_DIM_R                                      ~26     !4, !7
         33        FETCH_DIM_R                                      ~27     !8, ~26
         34        QM_ASSIGN                                        ~28     ~27
         35      > JMP                                                      ->37
         36    >   QM_ASSIGN                                        ~28     null
         37    >   ASSIGN_DIM                                               !6, !7
         38        OP_DATA                                                  ~28
   41    39      > JMP                                                      ->25
         40    >   FE_FREE                                                  $21
   44    41        ASSIGN_DIM                                               !5
         42        OP_DATA                                                  !6
   39    43    >   INIT_FCALL                                               'fgetcsv'
         44        SEND_VAR                                                 !1
         45        DO_ICALL                                         $30     
         46        ASSIGN                                           ~31     !8, $30
         47        TYPE_CHECK                                  1018          ~31
         48      > JMPNZ                                                    ~32, ->23
   46    49    >   INIT_FCALL                                               'fclose'
         50        SEND_VAR                                                 !1
         51        DO_ICALL                                                 
   47    52        INIT_FCALL                                               'var_export'
         53        SEND_VAR                                                 !5
         54        DO_ICALL                                                 
         55      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.23 ms | 1009 KiB | 20 Q