3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dt = new DateTime('2019-01-31'); $day = $dt->format('d'); $months = 0; for ($i=1; $months < 10; $i++) { $next = clone $dt; $next->add(new DateInterval("P{$i}M")); if ($next->format('d') != $day) continue; echo $next->format('Y-m-d') ."\n"; $months++; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 11
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 28
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 11
Branch analysis from position: 37
Branch analysis from position: 11
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 11
Branch analysis from position: 37
Branch analysis from position: 11
filename:       /in/imvZ8
function name:  (null)
number of ops:  38
compiled vars:  !0 = $dt, !1 = $day, !2 = $months, !3 = $i, !4 = $next
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $5      'DateTime'
          1        SEND_VAL_EX                                              '2019-01-31'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $5
    3     4        INIT_METHOD_CALL                                         !0, 'format'
          5        SEND_VAL_EX                                              'd'
          6        DO_FCALL                                      0  $8      
          7        ASSIGN                                                   !1, $8
    4     8        ASSIGN                                                   !2, 0
    5     9        ASSIGN                                                   !3, 1
         10      > JMP                                                      ->35
    6    11    >   CLONE                                            ~12     !0
         12        ASSIGN                                                   !4, ~12
    7    13        INIT_METHOD_CALL                                         !4, 'add'
         14        NEW                                              $14     'DateInterval'
         15        ROPE_INIT                                     3  ~16     'P'
         16        ROPE_ADD                                      1  ~16     ~16, !3
         17        ROPE_END                                      2  ~15     ~16, 'M'
         18        SEND_VAL_EX                                              ~15
         19        DO_FCALL                                      0          
         20        SEND_VAR_NO_REF_EX                                       $14
         21        DO_FCALL                                      0          
    8    22        INIT_METHOD_CALL                                         !4, 'format'
         23        SEND_VAL_EX                                              'd'
         24        DO_FCALL                                      0  $20     
         25        IS_NOT_EQUAL                                             !1, $20
         26      > JMPZ                                                     ~21, ->28
         27    > > JMP                                                      ->34
    9    28    >   INIT_METHOD_CALL                                         !4, 'format'
         29        SEND_VAL_EX                                              'Y-m-d'
         30        DO_FCALL                                      0  $22     
         31        CONCAT                                           ~23     $22, '%0A'
         32        ECHO                                                     ~23
   10    33        PRE_INC                                                  !2
    5    34    >   PRE_INC                                                  !3
         35    >   IS_SMALLER                                               !2, 10
         36      > JMPNZ                                                    ~26, ->11
   11    37    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
243.11 ms | 1012 KiB | 13 Q