3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = new DateTime('2010-12-02'); $start->modify('first day of this month'); $end = clone $start; $end->modify('-1 year'); $end->modify('first day of next month'); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start, $interval, $end); var_dump($period); foreach ($period as $dt) { echo $dt->format("Y-m") . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 36
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 36
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/oCGl0
function name:  (null)
number of ops:  38
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        SEND_VAL_EX                                              '2010-12-02'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $5
    3     4        INIT_METHOD_CALL                                         !0, 'modify'
          5        SEND_VAL_EX                                              'first+day+of+this+month'
          6        DO_FCALL                                      0          
    4     7        CLONE                                            ~9      !0
          8        ASSIGN                                                   !1, ~9
    5     9        INIT_METHOD_CALL                                         !1, 'modify'
         10        SEND_VAL_EX                                              '-1+year'
         11        DO_FCALL                                      0          
    6    12        INIT_METHOD_CALL                                         !1, 'modify'
         13        SEND_VAL_EX                                              'first+day+of+next+month'
         14        DO_FCALL                                      0          
    7    15        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         16        SEND_VAL                                                 '1+month'
         17        DO_FCALL                                      0  $13     
         18        ASSIGN                                                   !2, $13
    8    19        NEW                                              $15     'DatePeriod'
         20        SEND_VAR_EX                                              !0
         21        SEND_VAR_EX                                              !2
         22        SEND_VAR_EX                                              !1
         23        DO_FCALL                                      0          
         24        ASSIGN                                                   !3, $15
   10    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                                 
   12    28      > FE_RESET_R                                       $19     !3, ->36
         29    > > FE_FETCH_R                                               $19, !4, ->36
   13    30    >   INIT_METHOD_CALL                                         !4, 'format'
         31        SEND_VAL_EX                                              'Y-m'
         32        DO_FCALL                                      0  $20     
         33        CONCAT                                           ~21     $20, '%0A'
         34        ECHO                                                     ~21
   12    35      > JMP                                                      ->29
         36    >   FE_FREE                                                  $19
   14    37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.53 ms | 1396 KiB | 15 Q