3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = new DateTime('2010-12-02'); $start->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) { $month = $dt->format('m'); $year = $dt->format('Y'); if(date('Y-m',strtotime($end)) != $year.'-'.$month) echo $dt->format("Y-m") . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 51
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 51
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 50
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 50
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
filename:       /in/gUnVi
function name:  (null)
number of ops:  53
compiled vars:  !0 = $start, !1 = $end, !2 = $interval, !3 = $period, !4 = $dt, !5 = $month, !6 = $year
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $7      'DateTime'
          1        SEND_VAL_EX                                              '2010-12-02'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $7
    3     4        INIT_METHOD_CALL                                         !0, 'modify'
          5        SEND_VAL_EX                                              'first+day+of+this+month'
          6        DO_FCALL                                      0          
    4     7        NEW                                              $11     'DateTime'
          8        SEND_VAL_EX                                              '2012-05-06'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $11
    5    11        INIT_METHOD_CALL                                         !1, 'modify'
         12        SEND_VAL_EX                                              'first+day+of+next+month'
         13        DO_FCALL                                      0          
    6    14        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         15        SEND_VAL                                                 '1+month'
         16        DO_FCALL                                      0  $15     
         17        ASSIGN                                                   !2, $15
    7    18        NEW                                              $17     'DatePeriod'
         19        SEND_VAR_EX                                              !0
         20        SEND_VAR_EX                                              !2
         21        SEND_VAR_EX                                              !1
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !3, $17
    9    24      > FE_RESET_R                                       $20     !3, ->51
         25    > > FE_FETCH_R                                               $20, !4, ->51
   10    26    >   INIT_METHOD_CALL                                         !4, 'format'
         27        SEND_VAL_EX                                              'm'
         28        DO_FCALL                                      0  $21     
         29        ASSIGN                                                   !5, $21
   11    30        INIT_METHOD_CALL                                         !4, 'format'
         31        SEND_VAL_EX                                              'Y'
         32        DO_FCALL                                      0  $23     
         33        ASSIGN                                                   !6, $23
   13    34        INIT_FCALL                                               'date'
         35        SEND_VAL                                                 'Y-m'
         36        INIT_FCALL                                               'strtotime'
         37        SEND_VAR                                                 !1
         38        DO_ICALL                                         $25     
         39        SEND_VAR                                                 $25
         40        DO_ICALL                                         $26     
         41        CONCAT                                           ~27     !6, '-'
         42        CONCAT                                           ~28     ~27, !5
         43        IS_NOT_EQUAL                                             $26, ~28
         44      > JMPZ                                                     ~29, ->50
   14    45    >   INIT_METHOD_CALL                                         !4, 'format'
         46        SEND_VAL_EX                                              'Y-m'
         47        DO_FCALL                                      0  $30     
         48        CONCAT                                           ~31     $30, '%0A'
         49        ECHO                                                     ~31
    9    50    > > JMP                                                      ->25
         51    >   FE_FREE                                                  $20
   15    52      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.23 ms | 1392 KiB | 17 Q