3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = new DateTime('2010-12-02'); $end = clone $start; $end->modify('-1 year'); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start, $interval, $end); 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 = 20, Position 2 = 27
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 27
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/XsXLv
function name:  (null)
number of ops:  29
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        CLONE                                            ~8      !0
          5        ASSIGN                                                   !1, ~8
    4     6        INIT_METHOD_CALL                                         !1, 'modify'
          7        SEND_VAL_EX                                              '-1+year'
          8        DO_FCALL                                      0          
    5     9        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         10        SEND_VAL                                                 '1+month'
         11        DO_FCALL                                      0  $11     
         12        ASSIGN                                                   !2, $11
    6    13        NEW                                              $13     'DatePeriod'
         14        SEND_VAR_EX                                              !0
         15        SEND_VAR_EX                                              !2
         16        SEND_VAR_EX                                              !1
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !3, $13
    8    19      > FE_RESET_R                                       $16     !3, ->27
         20    > > FE_FETCH_R                                               $16, !4, ->27
    9    21    >   INIT_METHOD_CALL                                         !4, 'format'
         22        SEND_VAL_EX                                              'Y-m'
         23        DO_FCALL                                      0  $17     
         24        CONCAT                                           ~18     $17, '%0A'
         25        ECHO                                                     ~18
    8    26      > JMP                                                      ->20
         27    >   FE_FREE                                                  $16
   10    28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.82 ms | 1386 KiB | 13 Q