3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date=date('Y-m-d'); $start = new DateTime($date); $start->modify('first day of this month'); $end = new DateTime('2013-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 = 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/p9nRV
function name:  (null)
number of ops:  38
compiled vars:  !0 = $date, !1 = $start, !2 = $end, !3 = $interval, !4 = $period, !5 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'date'
          1        SEND_VAL                                                 'Y-m-d'
          2        DO_ICALL                                         $6      
          3        ASSIGN                                                   !0, $6
    5     4        NEW                                              $8      'DateTime'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $8
    6     8        INIT_METHOD_CALL                                         !1, 'modify'
          9        SEND_VAL_EX                                              'first+day+of+this+month'
         10        DO_FCALL                                      0          
    7    11        NEW                                              $12     'DateTime'
         12        SEND_VAL_EX                                              '2013-05-06'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !2, $12
    8    15        INIT_METHOD_CALL                                         !2, 'modify'
         16        SEND_VAL_EX                                              'first+day+of+next+month'
         17        DO_FCALL                                      0          
    9    18        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         19        SEND_VAL                                                 '1+month'
         20        DO_FCALL                                      0  $16     
         21        ASSIGN                                                   !3, $16
   10    22        NEW                                              $18     'DatePeriod'
         23        SEND_VAR_EX                                              !1
         24        SEND_VAR_EX                                              !3
         25        SEND_VAR_EX                                              !2
         26        DO_FCALL                                      0          
         27        ASSIGN                                                   !4, $18
   11    28      > FE_RESET_R                                       $21     !4, ->36
         29    > > FE_FETCH_R                                               $21, !5, ->36
   12    30    >   INIT_METHOD_CALL                                         !5, 'format'
         31        SEND_VAL_EX                                              'Y-m'
         32        DO_FCALL                                      0  $22     
         33        CONCAT                                           ~23     $22, '%0A'
         34        ECHO                                                     ~23
   11    35      > JMP                                                      ->29
         36    >   FE_FREE                                                  $21
   13    37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.61 ms | 1388 KiB | 15 Q