3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = new DateTime(date('Y-m-d')); $start->modify('first day of this month'); $end = new DateTime(date('Y-m-d', strtotime('-1 years'))); $end->modify('first day of next month'); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $dt) { echo $dt->format("Y-m") . "<br>\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 35, Position 2 = 42
Branch analysis from position: 35
2 jumps found. (Code = 78) Position 1 = 36, Position 2 = 42
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/gnNgl
function name:  (null)
number of ops:  44
compiled vars:  !0 = $start, !1 = $end, !2 = $interval, !3 = $period, !4 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $5      'DateTime'
          1        INIT_FCALL                                               'date'
          2        SEND_VAL                                                 'Y-m-d'
          3        DO_ICALL                                         $6      
          4        SEND_VAR_NO_REF_EX                                       $6
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $5
    3     7        INIT_METHOD_CALL                                         !0, 'modify'
          8        SEND_VAL_EX                                              'first+day+of+this+month'
          9        DO_FCALL                                      0          
    4    10        NEW                                              $10     'DateTime'
         11        INIT_FCALL                                               'date'
         12        SEND_VAL                                                 'Y-m-d'
         13        INIT_FCALL                                               'strtotime'
         14        SEND_VAL                                                 '-1+years'
         15        DO_ICALL                                         $11     
         16        SEND_VAR                                                 $11
         17        DO_ICALL                                         $12     
         18        SEND_VAR_NO_REF_EX                                       $12
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !1, $10
    5    21        INIT_METHOD_CALL                                         !1, 'modify'
         22        SEND_VAL_EX                                              'first+day+of+next+month'
         23        DO_FCALL                                      0          
    6    24        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         25        SEND_VAL                                                 '1+month'
         26        DO_FCALL                                      0  $16     
         27        ASSIGN                                                   !2, $16
    7    28        NEW                                              $18     'DatePeriod'
         29        SEND_VAR_EX                                              !0
         30        SEND_VAR_EX                                              !2
         31        SEND_VAR_EX                                              !1
         32        DO_FCALL                                      0          
         33        ASSIGN                                                   !3, $18
    9    34      > FE_RESET_R                                       $21     !3, ->42
         35    > > FE_FETCH_R                                               $21, !4, ->42
   10    36    >   INIT_METHOD_CALL                                         !4, 'format'
         37        SEND_VAL_EX                                              'Y-m'
         38        DO_FCALL                                      0  $22     
         39        CONCAT                                           ~23     $22, '%3Cbr%3E%0A'
         40        ECHO                                                     ~23
    9    41      > JMP                                                      ->35
         42    >   FE_FREE                                                  $21
   11    43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.43 ms | 1400 KiB | 17 Q