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); die(var_dump(date('Y-m-d', strtotime('-1 years')))); foreach ($period as $dt) { echo $dt->format("Y-m") . "<br>\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/drfS8
function name:  (null)
number of ops:  55
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
    8    34        INIT_FCALL                                               'var_dump'
         35        INIT_FCALL                                               'date'
         36        SEND_VAL                                                 'Y-m-d'
         37        INIT_FCALL                                               'strtotime'
         38        SEND_VAL                                                 '-1+years'
         39        DO_ICALL                                         $21     
         40        SEND_VAR                                                 $21
         41        DO_ICALL                                         $22     
         42        SEND_VAR                                                 $22
         43        DO_ICALL                                         $23     
         44      > EXIT                                                     $23
    9    45*       FE_RESET_R                                       $24     !3, ->53
         46*       FE_FETCH_R                                               $24, !4, ->53
   10    47*       INIT_METHOD_CALL                                         !4, 'format'
         48*       SEND_VAL_EX                                              'Y-m'
         49*       DO_FCALL                                      0  $25     
         50*       CONCAT                                           ~26     $25, '%3Cbr%3E%0A'
         51*       ECHO                                                     ~26
    9    52*       JMP                                                      ->46
         53*       FE_FREE                                                  $24
   11    54*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.15 ms | 1400 KiB | 19 Q