3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = (new DateTime('2017-01-01'))->modify('first day of this month'); $end = (new DateTime('2018-03-04'))->modify('first day of this month'); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start, $interval, $end); $months = array(); foreach ($period as $dt) { $months[] = $dt->format("F Y"); } print_r($months);
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/WTtlP
function name:  (null)
number of ops:  38
compiled vars:  !0 = $start, !1 = $end, !2 = $interval, !3 = $period, !4 = $months, !5 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $6      'DateTime'
          1        SEND_VAL_EX                                              '2017-01-01'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $6, 'modify'
          4        SEND_VAL_EX                                              'first+day+of+this+month'
          5        DO_FCALL                                      0  $8      
          6        ASSIGN                                                   !0, $8
    3     7        NEW                                              $10     'DateTime'
          8        SEND_VAL_EX                                              '2018-03-04'
          9        DO_FCALL                                      0          
         10        INIT_METHOD_CALL                                         $10, 'modify'
         11        SEND_VAL_EX                                              'first+day+of+this+month'
         12        DO_FCALL                                      0  $12     
         13        ASSIGN                                                   !1, $12
    4    14        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         15        SEND_VAL                                                 '1+month'
         16        DO_FCALL                                      0  $14     
         17        ASSIGN                                                   !2, $14
    5    18        NEW                                              $16     'DatePeriod'
         19        SEND_VAR_EX                                              !0
         20        SEND_VAR_EX                                              !2
         21        SEND_VAR_EX                                              !1
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !3, $16
    7    24        ASSIGN                                                   !4, <array>
    9    25      > FE_RESET_R                                       $20     !3, ->33
         26    > > FE_FETCH_R                                               $20, !5, ->33
   10    27    >   INIT_METHOD_CALL                                         !5, 'format'
         28        SEND_VAL_EX                                              'F+Y'
         29        DO_FCALL                                      0  $22     
         30        ASSIGN_DIM                                               !4
         31        OP_DATA                                                  $22
    9    32      > JMP                                                      ->26
         33    >   FE_FREE                                                  $20
   13    34        INIT_FCALL                                               'print_r'
         35        SEND_VAR                                                 !4
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.25 ms | 1396 KiB | 15 Q