3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = strtotime('20016-02-05'); $end = strtotime('2016-04-05'); $start_m = new DateTime('20016-02-05'); $end_m = new DateTime('2016-04-05'); $start_m->modify('first day of this month'); $end_m->modify('first day of next month'); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start_m, $interval, $end_m); foreach ($period as $dt) { $date_range_m[]=$dt->format("Y-m"); } print_r($date_range_m);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 33, Position 2 = 40
Branch analysis from position: 33
2 jumps found. (Code = 78) Position 1 = 34, Position 2 = 40
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/vC2kk
function name:  (null)
number of ops:  45
compiled vars:  !0 = $start, !1 = $end, !2 = $start_m, !3 = $end_m, !4 = $interval, !5 = $period, !6 = $dt, !7 = $date_range_m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'strtotime'
          1        SEND_VAL                                                 '20016-02-05'
          2        DO_ICALL                                         $8      
          3        ASSIGN                                                   !0, $8
    4     4        INIT_FCALL                                               'strtotime'
          5        SEND_VAL                                                 '2016-04-05'
          6        DO_ICALL                                         $10     
          7        ASSIGN                                                   !1, $10
    5     8        NEW                                              $12     'DateTime'
          9        SEND_VAL_EX                                              '20016-02-05'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $12
    6    12        NEW                                              $15     'DateTime'
         13        SEND_VAL_EX                                              '2016-04-05'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !3, $15
    7    16        INIT_METHOD_CALL                                         !2, 'modify'
         17        SEND_VAL_EX                                              'first+day+of+this+month'
         18        DO_FCALL                                      0          
    8    19        INIT_METHOD_CALL                                         !3, 'modify'
         20        SEND_VAL_EX                                              'first+day+of+next+month'
         21        DO_FCALL                                      0          
    9    22        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         23        SEND_VAL                                                 '1+month'
         24        DO_FCALL                                      0  $20     
         25        ASSIGN                                                   !4, $20
   10    26        NEW                                              $22     'DatePeriod'
         27        SEND_VAR_EX                                              !2
         28        SEND_VAR_EX                                              !4
         29        SEND_VAR_EX                                              !3
         30        DO_FCALL                                      0          
         31        ASSIGN                                                   !5, $22
   11    32      > FE_RESET_R                                       $25     !5, ->40
         33    > > FE_FETCH_R                                               $25, !6, ->40
   12    34    >   INIT_METHOD_CALL                                         !6, 'format'
         35        SEND_VAL_EX                                              'Y-m'
         36        DO_FCALL                                      0  $27     
         37        ASSIGN_DIM                                               !7
         38        OP_DATA                                                  $27
   11    39      > JMP                                                      ->33
         40    >   FE_FREE                                                  $25
   15    41        INIT_FCALL                                               'print_r'
         42        SEND_VAR                                                 !7
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.58 ms | 1392 KiB | 17 Q