3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('America/New_York'); //DST starts Apr. 2nd 02:00 and moves to 03:00 $start = new \DateTime('2006-04-02T01:00:00'); $end = new \DateTime('2006-04-02T04:00:00'); while($end > $start) { $now = clone $end; $end->sub(new \DateInterval('PT1H')); echo $end->format('Y-m-d H:i T') . PHP_EOL; if ($now == $end) { break; //remove this will result in an endless loop } } echo '-----' . \PHP_EOL; //DST ends Oct. 29th 02:00 and moves to 01:00 $start = new \DateTime('2006-10-29T00:30:00'); $end = new \DateTime('2006-10-29T03:00:00'); $i = 0; while($end > $start) { $now = clone $start; $start->add(new \DateInterval('PT30M')); echo $start->format('Y-m-d H:i T') . PHP_EOL; if ($i++ > 7) { break; //remove this will result in an endless loop } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 12
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 41
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 58
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
Branch analysis from position: 58
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 28
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 28
filename:       /in/lUaT9
function name:  (null)
number of ops:  61
compiled vars:  !0 = $start, !1 = $end, !2 = $now, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'America%2FNew_York'
          2        DO_ICALL                                                 
    6     3        NEW                                              $5      'DateTime'
          4        SEND_VAL_EX                                              '2006-04-02T01%3A00%3A00'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $5
    7     7        NEW                                              $8      'DateTime'
          8        SEND_VAL_EX                                              '2006-04-02T04%3A00%3A00'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $8
    9    11      > JMP                                                      ->28
   10    12    >   CLONE                                            ~11     !1
         13        ASSIGN                                                   !2, ~11
   11    14        INIT_METHOD_CALL                                         !1, 'sub'
         15        NEW                                              $13     'DateInterval'
         16        SEND_VAL_EX                                              'PT1H'
         17        DO_FCALL                                      0          
         18        SEND_VAR_NO_REF_EX                                       $13
         19        DO_FCALL                                      0          
   12    20        INIT_METHOD_CALL                                         !1, 'format'
         21        SEND_VAL_EX                                              'Y-m-d+H%3Ai+T'
         22        DO_FCALL                                      0  $16     
         23        CONCAT                                           ~17     $16, '%0A'
         24        ECHO                                                     ~17
   13    25        IS_EQUAL                                                 !2, !1
         26      > JMPZ                                                     ~18, ->28
   14    27    > > JMP                                                      ->30
    9    28    >   IS_SMALLER                                               !0, !1
         29      > JMPNZ                                                    ~19, ->12
   18    30    >   ECHO                                                     '-----%0A'
   21    31        NEW                                              $20     'DateTime'
         32        SEND_VAL_EX                                              '2006-10-29T00%3A30%3A00'
         33        DO_FCALL                                      0          
         34        ASSIGN                                                   !0, $20
   22    35        NEW                                              $23     'DateTime'
         36        SEND_VAL_EX                                              '2006-10-29T03%3A00%3A00'
         37        DO_FCALL                                      0          
         38        ASSIGN                                                   !1, $23
   24    39        ASSIGN                                                   !3, 0
   25    40      > JMP                                                      ->58
   26    41    >   CLONE                                            ~27     !0
         42        ASSIGN                                                   !2, ~27
   27    43        INIT_METHOD_CALL                                         !0, 'add'
         44        NEW                                              $29     'DateInterval'
         45        SEND_VAL_EX                                              'PT30M'
         46        DO_FCALL                                      0          
         47        SEND_VAR_NO_REF_EX                                       $29
         48        DO_FCALL                                      0          
   28    49        INIT_METHOD_CALL                                         !0, 'format'
         50        SEND_VAL_EX                                              'Y-m-d+H%3Ai+T'
         51        DO_FCALL                                      0  $32     
         52        CONCAT                                           ~33     $32, '%0A'
         53        ECHO                                                     ~33
   29    54        POST_INC                                         ~34     !3
         55        IS_SMALLER                                               7, ~34
         56      > JMPZ                                                     ~35, ->58
   30    57    > > JMP                                                      ->60
   25    58    >   IS_SMALLER                                               !0, !1
         59      > JMPNZ                                                    ~36, ->41
   32    60    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.39 ms | 1400 KiB | 15 Q