3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.23 ms | 1447 KiB | 13 Q