3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.88 ms | 941 KiB | 18 Q