3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.2 ms | 1396 KiB | 15 Q