3v4l.org

run code in 500+ PHP versions simultaneously
<?php $data = [ ['month' => 'Jan', 'year' => 2022, 'data' => ['Jan' => 1563, 'Mar' => 6]], ['month' => 'Feb', 'year' => 2022, 'data' => ['Feb' => 345, 'Mar' => 76, 'May' => 8]], ]; for($row = 1; $row <= 12; $row++){ $monthNameLong = date('F', mktime(0, 0, 0, $row, 1, date('Y'))); $monthNameShort = date('M', strtotime("2022-$row-01")); echo '<tr>'; printf('<td>%1$s</td>', $monthNameLong); if(($data[$row - 1]['month'] ?? null) === $monthNameShort && isset($data[$row - 1]['data'][$monthNameShort])){ $total = $data[$row - 1]['data'][$monthNameShort]; } else { $total = ''; } printf('<td>%1$s</td>', $total); for($col = 1; $col <= 12; $col++){ $colMonthNameShort = date('M', strtotime("2022-$col-01")); printf('<td>%1$s</td>', $data[$row - 1]['data'][$colMonthNameShort] ?? 0); } echo '</tr>'; echo PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
2 jumps found. (Code = 44) Position 1 = 90, Position 2 = 3
Branch analysis from position: 90
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 42, Position 2 = 47
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 54
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 55
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
2 jumps found. (Code = 44) Position 1 = 85, Position 2 = 61
Branch analysis from position: 85
2 jumps found. (Code = 44) Position 1 = 90, Position 2 = 3
Branch analysis from position: 90
Branch analysis from position: 3
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 85, Position 2 = 61
Branch analysis from position: 85
Branch analysis from position: 61
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
Branch analysis from position: 47
filename:       /in/JecP1
function name:  (null)
number of ops:  91
compiled vars:  !0 = $data, !1 = $row, !2 = $monthNameLong, !3 = $monthNameShort, !4 = $total, !5 = $col, !6 = $colMonthNameShort
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    8     1        ASSIGN                                                       !1, 1
          2      > JMP                                                          ->88
    9     3    >   INIT_FCALL                                                   'date'
          4        SEND_VAL                                                     'F'
          5        INIT_FCALL                                                   'mktime'
          6        SEND_VAL                                                     0
          7        SEND_VAL                                                     0
          8        SEND_VAL                                                     0
          9        SEND_VAR                                                     !1
         10        SEND_VAL                                                     1
         11        INIT_FCALL                                                   'date'
         12        SEND_VAL                                                     'Y'
         13        DO_ICALL                                             $9      
         14        SEND_VAR                                                     $9
         15        DO_ICALL                                             $10     
         16        SEND_VAR                                                     $10
         17        DO_ICALL                                             $11     
         18        ASSIGN                                                       !2, $11
   10    19        INIT_FCALL                                                   'date'
         20        SEND_VAL                                                     'M'
         21        INIT_FCALL                                                   'strtotime'
         22        ROPE_INIT                                         3  ~14     '2022-'
         23        ROPE_ADD                                          1  ~14     ~14, !1
         24        ROPE_END                                          2  ~13     ~14, '-01'
         25        SEND_VAL                                                     ~13
         26        DO_ICALL                                             $16     
         27        SEND_VAR                                                     $16
         28        DO_ICALL                                             $17     
         29        ASSIGN                                                       !3, $17
   12    30        ECHO                                                         '%3Ctr%3E'
   13    31        INIT_FCALL                                                   'printf'
         32        SEND_VAL                                                     '%3Ctd%3E%251%24s%3C%2Ftd%3E'
         33        SEND_VAR                                                     !2
         34        DO_ICALL                                                     
   14    35        SUB                                                  ~20     !1, 1
         36        FETCH_DIM_IS                                         ~21     !0, ~20
         37        FETCH_DIM_IS                                         ~22     ~21, 'month'
         38        COALESCE                                             ~23     ~22
         39        QM_ASSIGN                                            ~23     null
         40        IS_IDENTICAL                                         ~24     !3, ~23
         41      > JMPZ_EX                                              ~24     ~24, ->47
         42    >   SUB                                                  ~25     !1, 1
         43        FETCH_DIM_IS                                         ~26     !0, ~25
         44        FETCH_DIM_IS                                         ~27     ~26, 'data'
         45        ISSET_ISEMPTY_DIM_OBJ                             0  ~28     ~27, !3
         46        BOOL                                                 ~24     ~28
         47    > > JMPZ                                                         ~24, ->54
   15    48    >   SUB                                                  ~29     !1, 1
         49        FETCH_DIM_R                                          ~30     !0, ~29
         50        FETCH_DIM_R                                          ~31     ~30, 'data'
         51        FETCH_DIM_R                                          ~32     ~31, !3
         52        ASSIGN                                                       !4, ~32
   14    53      > JMP                                                          ->55
   17    54    >   ASSIGN                                                       !4, ''
   20    55    >   INIT_FCALL                                                   'printf'
         56        SEND_VAL                                                     '%3Ctd%3E%251%24s%3C%2Ftd%3E'
         57        SEND_VAR                                                     !4
         58        DO_ICALL                                                     
   22    59        ASSIGN                                                       !5, 1
         60      > JMP                                                          ->83
   23    61    >   INIT_FCALL                                                   'date'
         62        SEND_VAL                                                     'M'
         63        INIT_FCALL                                                   'strtotime'
         64        ROPE_INIT                                         3  ~38     '2022-'
         65        ROPE_ADD                                          1  ~38     ~38, !5
         66        ROPE_END                                          2  ~37     ~38, '-01'
         67        SEND_VAL                                                     ~37
         68        DO_ICALL                                             $40     
         69        SEND_VAR                                                     $40
         70        DO_ICALL                                             $41     
         71        ASSIGN                                                       !6, $41
   24    72        INIT_FCALL                                                   'printf'
         73        SEND_VAL                                                     '%3Ctd%3E%251%24s%3C%2Ftd%3E'
         74        SUB                                                  ~43     !1, 1
         75        FETCH_DIM_IS                                         ~44     !0, ~43
         76        FETCH_DIM_IS                                         ~45     ~44, 'data'
         77        FETCH_DIM_IS                                         ~46     ~45, !6
         78        COALESCE                                             ~47     ~46
         79        QM_ASSIGN                                            ~47     0
         80        SEND_VAL                                                     ~47
         81        DO_ICALL                                                     
   22    82        PRE_INC                                                      !5
         83    >   IS_SMALLER_OR_EQUAL                                          !5, 12
         84      > JMPNZ                                                        ~50, ->61
   27    85    >   ECHO                                                         '%3C%2Ftr%3E'
   28    86        ECHO                                                         '%0A'
    8    87        PRE_INC                                                      !1
         88    >   IS_SMALLER_OR_EQUAL                                          !1, 12
         89      > JMPNZ                                                        ~52, ->3
   29    90    > > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
152.28 ms | 2252 KiB | 17 Q