3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('UTC'); $today = new DateTime; //to be sure that DateInterval will work as intended //we take the first day of the month $fist_day_of_the_month = $tody->format('Y-m-01'); $range = new DatePeriod( new DateTime($fist_day_of_the_month), //begin new DateInterval('P1M'), //interval new DateTime($fist_day_of_the_month.' +24 month') //end ); foreach ($range as $date) { echo $date->format('Y-m-d'), PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 34
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 34
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/GJN2i
function name:  (null)
number of ops:  36
compiled vars:  !0 = $today, !1 = $fist_day_of_the_month, !2 = $tody, !3 = $range, !4 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'UTC'
          2        DO_ICALL                                                 
    3     3        NEW                                              $6      'DateTime'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $6
    6     6        INIT_METHOD_CALL                                         !2, 'format'
          7        SEND_VAL_EX                                              'Y-m-01'
          8        DO_FCALL                                      0  $9      
          9        ASSIGN                                                   !1, $9
    8    10        NEW                                              $11     'DatePeriod'
    9    11        NEW                                              $12     'DateTime'
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
         14        SEND_VAR_NO_REF_EX                                       $12
   10    15        NEW                                              $14     'DateInterval'
         16        SEND_VAL_EX                                              'P1M'
         17        DO_FCALL                                      0          
         18        SEND_VAR_NO_REF_EX                                       $14
   11    19        NEW                                              $16     'DateTime'
         20        CONCAT                                           ~17     !1, '+%2B24+month'
         21        SEND_VAL_EX                                              ~17
         22        DO_FCALL                                      0          
         23        SEND_VAR_NO_REF_EX                                       $16
         24        DO_FCALL                                      0          
    8    25        ASSIGN                                                   !3, $11
   14    26      > FE_RESET_R                                       $21     !3, ->34
         27    > > FE_FETCH_R                                               $21, !4, ->34
   15    28    >   INIT_METHOD_CALL                                         !4, 'format'
         29        SEND_VAL_EX                                              'Y-m-d'
         30        DO_FCALL                                      0  $22     
         31        ECHO                                                     $22
         32        ECHO                                                     '%0A'
   14    33      > JMP                                                      ->27
         34    >   FE_FREE                                                  $21
   16    35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.1 ms | 1396 KiB | 15 Q