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); var_export(\n); for ($i = 1; $i <= $months ; $i++) { $currentDateImmutable = \DateTimeImmutable::createFromMutable($currentDate); $daysUntilNextMonth = $currentDateImmutable->diff($currentDateImmutable->modify('last day of this month'))->d; var_export($daysUntilNextMonth); var_export("\n"); for ($j = 1; $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 = 52
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 22
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 42
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 22
Branch analysis from position: 54
Branch analysis from position: 22
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 42
Branch analysis from position: 48
Branch analysis from position: 42
filename:       /in/FR5v9
function name:  (null)
number of ops:  55
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        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
    8    16        INIT_FCALL                                               'var_export'
         17        FETCH_CONSTANT                                   ~17     'n'
         18        SEND_VAL                                                 ~17
         19        DO_ICALL                                                 
   10    20        ASSIGN                                                   !3, 1
         21      > JMP                                                      ->52
   12    22    >   INIT_STATIC_METHOD_CALL                                  'DateTimeImmutable', 'createFromMutable'
         23        SEND_VAR                                                 !0
         24        DO_FCALL                                      0  $20     
         25        ASSIGN                                                   !4, $20
   13    26        INIT_METHOD_CALL                                         !4, 'diff'
         27        INIT_METHOD_CALL                                         !4, 'modify'
         28        SEND_VAL_EX                                              'last+day+of+this+month'
         29        DO_FCALL                                      0  $22     
         30        SEND_VAR_NO_REF_EX                                       $22
         31        DO_FCALL                                      0  $23     
         32        FETCH_OBJ_R                                      ~24     $23, 'd'
         33        ASSIGN                                                   !5, ~24
   15    34        INIT_FCALL                                               'var_export'
         35        SEND_VAR                                                 !5
         36        DO_ICALL                                                 
   16    37        INIT_FCALL                                               'var_export'
         38        SEND_VAL                                                 '%0A'
         39        DO_ICALL                                                 
   18    40        ASSIGN                                                   !6, 1
         41      > JMP                                                      ->46
   19    42    >   INIT_METHOD_CALL                                         !0, 'modify'
         43        SEND_VAL_EX                                              '%2B1+day'
         44        DO_FCALL                                      0          
   18    45        PRE_INC                                                  !6
         46    >   IS_SMALLER_OR_EQUAL                                      !6, !5
         47      > JMPNZ                                                    ~31, ->42
   22    48    >   INIT_FCALL                                               'var_dump'
         49        SEND_VAR                                                 !0
         50        DO_ICALL                                                 
   10    51        PRE_INC                                                  !3
         52    >   IS_SMALLER_OR_EQUAL                                      !3, !2
         53      > JMPNZ                                                    ~34, ->22
   24    54    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.68 ms | 1400 KiB | 17 Q