3v4l.org

run code in 300+ PHP versions simultaneously
<?php function countDaysForChoosenYears(int $year):int { $att = []; for ($i = 1; $i <= 12; $i++) { $att[] = cal_days_in_month(CAL_GREGORIAN, $i, $year); } $att = array_sum($att); return $att; } $YearMonthDayStructure = []; $Date = new DateTime('2016-01-01'); for ($i = 1; $i <= countDaysForChoosenYears(2016); $i++) { $monthName = $Date->format('F'); $yearNumber = $Date->format('Y'); $YearMonthDayStructure[$yearNumber][$monthName][$Date->format('d')] = $Date->add(new DateInterval('P1D'))->format('Y-m-d'); } print_r($YearMonthDayStructure);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 7
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 7
Branch analysis from position: 37
Branch analysis from position: 7
filename:       /in/uRRfU
function name:  (null)
number of ops:  41
compiled vars:  !0 = $YearMonthDayStructure, !1 = $Date, !2 = $i, !3 = $monthName, !4 = $yearNumber
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   14     1        NEW                                              $6      'DateTime'
          2        SEND_VAL_EX                                              '2016-01-01'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $6
   17     5        ASSIGN                                                   !2, 1
          6      > JMP                                                      ->32
   19     7    >   INIT_METHOD_CALL                                         !1, 'format'
          8        SEND_VAL_EX                                              'F'
          9        DO_FCALL                                      0  $10     
         10        ASSIGN                                                   !3, $10
   20    11        INIT_METHOD_CALL                                         !1, 'format'
         12        SEND_VAL_EX                                              'Y'
         13        DO_FCALL                                      0  $12     
         14        ASSIGN                                                   !4, $12
   22    15        INIT_METHOD_CALL                                         !1, 'format'
         16        SEND_VAL_EX                                              'd'
         17        DO_FCALL                                      0  $16     
         18        INIT_METHOD_CALL                                         !1, 'add'
         19        NEW                                              $18     'DateInterval'
         20        SEND_VAL_EX                                              'P1D'
         21        DO_FCALL                                      0          
         22        SEND_VAR_NO_REF_EX                                       $18
         23        DO_FCALL                                      0  $20     
         24        INIT_METHOD_CALL                                         $20, 'format'
         25        SEND_VAL_EX                                              'Y-m-d'
         26        DO_FCALL                                      0  $21     
         27        FETCH_DIM_W                                      $14     !0, !4
         28        FETCH_DIM_W                                      $15     $14, !3
         29        ASSIGN_DIM                                               $15, $16
         30        OP_DATA                                                  $21
   17    31        PRE_INC                                                  !2
         32    >   INIT_FCALL                                               'countdaysforchoosenyears'
         33        SEND_VAL                                                 2016
         34        DO_FCALL                                      0  $23     
         35        IS_SMALLER_OR_EQUAL                                      !2, $23
         36      > JMPNZ                                                    ~24, ->7
   26    37    >   INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !0
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Function countdaysforchoosenyears:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 4
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 4
Branch analysis from position: 15
Branch analysis from position: 4
filename:       /in/uRRfU
function name:  countDaysForChoosenYears
number of ops:  23
compiled vars:  !0 = $year, !1 = $att, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, 1
          3      > JMP                                                      ->13
    6     4    >   INIT_FCALL_BY_NAME                                       'cal_days_in_month'
          5        FETCH_CONSTANT                                   ~6      'CAL_GREGORIAN'
          6        SEND_VAL_EX                                              ~6
          7        SEND_VAR_EX                                              !2
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $7      
         10        ASSIGN_DIM                                               !1
         11        OP_DATA                                                  $7
    5    12        PRE_INC                                                  !2
         13    >   IS_SMALLER_OR_EQUAL                                      !2, 12
         14      > JMPNZ                                                    ~9, ->4
    8    15    >   INIT_FCALL                                               'array_sum'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $10     
         18        ASSIGN                                                   !1, $10
    9    19        VERIFY_RETURN_TYPE                                       !1
         20      > RETURN                                                   !1
   10    21*       VERIFY_RETURN_TYPE                                       
         22*     > RETURN                                                   null

End of function countdaysforchoosenyears

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.77 ms | 1403 KiB | 18 Q