3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.04 ms | 1395 KiB | 13 Q