3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.57 ms | 1400 KiB | 17 Q