3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new DateTime(date('Y-m-d', strtotime('1st day of last month'))); $i = new DateInterval('P1M'); $end = new DateTime('-1 year'); while ($date >= $end) { echo $date->format('Y F') . PHP_EOL; $date = $date->sub($i); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 20
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 20
Branch analysis from position: 31
Branch analysis from position: 20
filename:       /in/kk6FN
function name:  (null)
number of ops:  32
compiled vars:  !0 = $date, !1 = $i, !2 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $3      'DateTime'
          1        INIT_FCALL                                               'date'
          2        SEND_VAL                                                 'Y-m-d'
          3        INIT_FCALL                                               'strtotime'
          4        SEND_VAL                                                 '1st+day+of+last+month'
          5        DO_ICALL                                         $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                         $5      
          8        SEND_VAR_NO_REF_EX                                       $5
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !0, $3
    3    11        NEW                                              $8      'DateInterval'
         12        SEND_VAL_EX                                              'P1M'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $8
    4    15        NEW                                              $11     'DateTime'
         16        SEND_VAL_EX                                              '-1+year'
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !2, $11
    5    19      > JMP                                                      ->29
    6    20    >   INIT_METHOD_CALL                                         !0, 'format'
         21        SEND_VAL_EX                                              'Y+F'
         22        DO_FCALL                                      0  $14     
         23        CONCAT                                           ~15     $14, '%0A'
         24        ECHO                                                     ~15
    7    25        INIT_METHOD_CALL                                         !0, 'sub'
         26        SEND_VAR_EX                                              !1
         27        DO_FCALL                                      0  $16     
         28        ASSIGN                                                   !0, $16
    5    29    >   IS_SMALLER_OR_EQUAL                                      !2, !0
         30      > JMPNZ                                                    ~18, ->20
    8    31    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.88 ms | 1388 KiB | 17 Q