3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getDaysUnderTempDictionary(float $targetTemp): array { //This is just for mocking a CSV file $dataString = <<<EOT 2019,1,1,0,0.1 2019,1,1,1,0.4 2019,1,1,2,0.8 2019,1,1,3,1.3 2019,1,1,4,1.8 2020,1,1,0,-3.9 EOT; $stream = fopen('php://memory', 'r+'); fwrite($stream, $dataString); rewind($stream); $years = []; while ($data = fgetcsv($stream)) { $year = $data[0]; if ($data[4] <= $targetTemp) { if(!isset($years[$year])){ $years[$year] = 0; } $years[$year]++; } } foreach($years as $year => $hours){ $years[$year] = $hours / 24; } return $years; } var_dump(getDaysUnderTempDictionary(4));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RWFPK
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'getdaysundertempdictionary'
          2        SEND_VAL                                                 4
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function getdaysundertempdictionary:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 16
Branch analysis from position: 33
2 jumps found. (Code = 77) Position 1 = 34, Position 2 = 40
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 40
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 28
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 16
Branch analysis from position: 33
Branch analysis from position: 16
Branch analysis from position: 26
Branch analysis from position: 28
filename:       /in/RWFPK
function name:  getDaysUnderTempDictionary
number of ops:  45
compiled vars:  !0 = $targetTemp, !1 = $dataString, !2 = $stream, !3 = $years, !4 = $year, !5 = $data, !6 = $hours
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, '2019%2C1%2C1%2C0%2C0.1%0A2019%2C1%2C1%2C1%2C0.4%0A2019%2C1%2C1%2C2%2C0.8%0A2019%2C1%2C1%2C3%2C1.3%0A2019%2C1%2C1%2C4%2C1.8%0A2020%2C1%2C1%2C0%2C-3.9'
   13     2        INIT_FCALL                                               'fopen'
          3        SEND_VAL                                                 'php%3A%2F%2Fmemory'
          4        SEND_VAL                                                 'r%2B'
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !2, $8
   14     7        INIT_FCALL                                               'fwrite'
          8        SEND_VAR                                                 !2
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
   15    11        INIT_FCALL                                               'rewind'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                                 
   17    14        ASSIGN                                                   !3, <array>
   18    15      > JMP                                                      ->28
   19    16    >   FETCH_DIM_R                                      ~13     !5, 0
         17        ASSIGN                                                   !4, ~13
   20    18        FETCH_DIM_R                                      ~15     !5, 4
         19        IS_SMALLER_OR_EQUAL                                      ~15, !0
         20      > JMPZ                                                     ~16, ->28
   21    21    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~17     !3, !4
         22        BOOL_NOT                                         ~18     ~17
         23      > JMPZ                                                     ~18, ->26
   22    24    >   ASSIGN_DIM                                               !3, !4
         25        OP_DATA                                                  0
   24    26    >   FETCH_DIM_RW                                     $20     !3, !4
         27        PRE_INC                                                  $20
   18    28    >   INIT_FCALL                                               'fgetcsv'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                         $22     
         31        ASSIGN                                           ~23     !5, $22
         32      > JMPNZ                                                    ~23, ->16
   27    33    > > FE_RESET_R                                       $24     !3, ->40
         34    > > FE_FETCH_R                                       ~25     $24, !6, ->40
         35    >   ASSIGN                                                   !4, ~25
   28    36        DIV                                              ~28     !6, 24
         37        ASSIGN_DIM                                               !3, !4
         38        OP_DATA                                                  ~28
   27    39      > JMP                                                      ->34
         40    >   FE_FREE                                                  $24
   30    41        VERIFY_RETURN_TYPE                                       !3
         42      > RETURN                                                   !3
   31    43*       VERIFY_RETURN_TYPE                                       
         44*     > RETURN                                                   null

End of function getdaysundertempdictionary

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.17 ms | 1009 KiB | 19 Q