3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.17 ms | 1399 KiB | 13 Q