3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = (new DateTime('1 year ago'))->modify('last day of this month'); $end = (new DateTime())->modify('last day of this month'); $interval = new DateInterval('P1M'); $period = new DatePeriod($start, $interval, $end); $months = array(); foreach ($period as $dt) { $months[$dt->format('Y-m-d')] = $dt->format('Y-m'); } $reverse_months = array_reverse($months); print_r($reverse_months);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 35
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 35
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/a7XEg
function name:  (null)
number of ops:  44
compiled vars:  !0 = $start, !1 = $end, !2 = $interval, !3 = $period, !4 = $months, !5 = $dt, !6 = $reverse_months
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $7      'DateTime'
          1        SEND_VAL_EX                                              '1+year+ago'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $7, 'modify'
          4        SEND_VAL_EX                                              'last+day+of+this+month'
          5        DO_FCALL                                      0  $9      
          6        ASSIGN                                                   !0, $9
    3     7        NEW                                              $11     'DateTime'
          8        DO_FCALL                                      0          
          9        INIT_METHOD_CALL                                         $11, 'modify'
         10        SEND_VAL_EX                                              'last+day+of+this+month'
         11        DO_FCALL                                      0  $13     
         12        ASSIGN                                                   !1, $13
    4    13        NEW                                              $15     'DateInterval'
         14        SEND_VAL_EX                                              'P1M'
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !2, $15
    5    17        NEW                                              $18     'DatePeriod'
         18        SEND_VAR_EX                                              !0
         19        SEND_VAR_EX                                              !2
         20        SEND_VAR_EX                                              !1
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !3, $18
    7    23        ASSIGN                                                   !4, <array>
    8    24      > FE_RESET_R                                       $22     !3, ->35
         25    > > FE_FETCH_R                                               $22, !5, ->35
    9    26    >   INIT_METHOD_CALL                                         !5, 'format'
         27        SEND_VAL_EX                                              'Y-m-d'
         28        DO_FCALL                                      0  $23     
         29        INIT_METHOD_CALL                                         !5, 'format'
         30        SEND_VAL_EX                                              'Y-m'
         31        DO_FCALL                                      0  $25     
         32        ASSIGN_DIM                                               !4, $23
         33        OP_DATA                                                  $25
    8    34      > JMP                                                      ->25
         35    >   FE_FREE                                                  $22
   11    36        INIT_FCALL                                               'array_reverse'
         37        SEND_VAR                                                 !4
         38        DO_ICALL                                         $26     
         39        ASSIGN                                                   !6, $26
   12    40        INIT_FCALL                                               'print_r'
         41        SEND_VAR                                                 !6
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.51 ms | 1392 KiB | 17 Q