3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.38 ms | 1443 KiB | 13 Q