3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.81 ms | 1400 KiB | 19 Q