3v4l.org

run code in 300+ PHP versions simultaneously
<?php $currentDate = new DateTime('2016-01-01'); $reportEndDate = new DateTime('2016-05-31'); $months = $currentDate->diff($reportEndDate)->m; var_export($months."\n"); for ($i = 0; $i <= $months ; $i++) { $currentDateImmutable = \DateTimeImmutable::createFromMutable($currentDate); $daysUntilNextMonth = $currentDateImmutable->diff($currentDateImmutable->modify('last day of this month'))->d; var_export($daysUntilNextMonth."\n"); for ($j = 0; $j <= $daysUntilNextMonth ; $j++) { $currentDate->modify('+1 day'); } var_dump($currentDate); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 19
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 37
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 49, Position 2 = 19
Branch analysis from position: 49
Branch analysis from position: 19
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 37
Branch analysis from position: 43
Branch analysis from position: 37
filename:       /in/7X1jQ
function name:  (null)
number of ops:  50
compiled vars:  !0 = $currentDate, !1 = $reportEndDate, !2 = $months, !3 = $i, !4 = $currentDateImmutable, !5 = $daysUntilNextMonth, !6 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $7      'DateTime'
          1        SEND_VAL_EX                                              '2016-01-01'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $7
    4     4        NEW                                              $10     'DateTime'
          5        SEND_VAL_EX                                              '2016-05-31'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $10
    6     8        INIT_METHOD_CALL                                         !0, 'diff'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $13     
         11        FETCH_OBJ_R                                      ~14     $13, 'm'
         12        ASSIGN                                                   !2, ~14
    7    13        INIT_FCALL                                               'var_export'
         14        CONCAT                                           ~16     !2, '%0A'
         15        SEND_VAL                                                 ~16
         16        DO_ICALL                                                 
   10    17        ASSIGN                                                   !3, 0
         18      > JMP                                                      ->47
   12    19    >   INIT_STATIC_METHOD_CALL                                  'DateTimeImmutable', 'createFromMutable'
         20        SEND_VAR                                                 !0
         21        DO_FCALL                                      0  $19     
         22        ASSIGN                                                   !4, $19
   13    23        INIT_METHOD_CALL                                         !4, 'diff'
         24        INIT_METHOD_CALL                                         !4, 'modify'
         25        SEND_VAL_EX                                              'last+day+of+this+month'
         26        DO_FCALL                                      0  $21     
         27        SEND_VAR_NO_REF_EX                                       $21
         28        DO_FCALL                                      0  $22     
         29        FETCH_OBJ_R                                      ~23     $22, 'd'
         30        ASSIGN                                                   !5, ~23
   15    31        INIT_FCALL                                               'var_export'
         32        CONCAT                                           ~25     !5, '%0A'
         33        SEND_VAL                                                 ~25
         34        DO_ICALL                                                 
   17    35        ASSIGN                                                   !6, 0
         36      > JMP                                                      ->41
   18    37    >   INIT_METHOD_CALL                                         !0, 'modify'
         38        SEND_VAL_EX                                              '%2B1+day'
         39        DO_FCALL                                      0          
   17    40        PRE_INC                                                  !6
         41    >   IS_SMALLER_OR_EQUAL                                      !6, !5
         42      > JMPNZ                                                    ~30, ->37
   21    43    >   INIT_FCALL                                               'var_dump'
         44        SEND_VAR                                                 !0
         45        DO_ICALL                                                 
   10    46        PRE_INC                                                  !3
         47    >   IS_SMALLER_OR_EQUAL                                      !3, !2
         48      > JMPNZ                                                    ~33, ->19
   23    49    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.43 ms | 1400 KiB | 17 Q