3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('America/New_York'); //DST starts Apr. 2nd 01: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 $date = new DateTime('2006-10-29T00:30:00'); foreach(range(1,4) as $i) { $date->add(new DateInterval('PT30M')); echo $date->format('Y-m-d H:i T'). PHP_EOL; }
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
2 jumps found. (Code = 77) Position 1 = 40, Position 2 = 53
Branch analysis from position: 40
2 jumps found. (Code = 78) Position 1 = 41, Position 2 = 53
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
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/ZNfgq
function name:  (null)
number of ops:  55
compiled vars:  !0 = $start, !1 = $end, !2 = $now, !3 = $date, !4 = $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                                              $6      'DateTime'
          4        SEND_VAL_EX                                              '2006-04-02T01%3A00%3A00'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $6
    7     7        NEW                                              $9      'DateTime'
          8        SEND_VAL_EX                                              '2006-04-02T04%3A00%3A00'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $9
    9    11      > JMP                                                      ->28
   10    12    >   CLONE                                            ~12     !1
         13        ASSIGN                                                   !2, ~12
   11    14        INIT_METHOD_CALL                                         !1, 'sub'
         15        NEW                                              $14     'DateInterval'
         16        SEND_VAL_EX                                              'PT1H'
         17        DO_FCALL                                      0          
         18        SEND_VAR_NO_REF_EX                                       $14
         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  $17     
         23        CONCAT                                           ~18     $17, '%0A'
         24        ECHO                                                     ~18
   13    25        IS_EQUAL                                                 !2, !1
         26      > JMPZ                                                     ~19, ->28
   14    27    > > JMP                                                      ->30
    9    28    >   IS_SMALLER                                               !0, !1
         29      > JMPNZ                                                    ~20, ->12
   18    30    >   ECHO                                                     '-----%0A'
   21    31        NEW                                              $21     'DateTime'
         32        SEND_VAL_EX                                              '2006-10-29T00%3A30%3A00'
         33        DO_FCALL                                      0          
         34        ASSIGN                                                   !3, $21
   23    35        INIT_FCALL                                               'range'
         36        SEND_VAL                                                 1
         37        SEND_VAL                                                 4
         38        DO_ICALL                                         $24     
         39      > FE_RESET_R                                       $25     $24, ->53
         40    > > FE_FETCH_R                                               $25, !4, ->53
   24    41    >   INIT_METHOD_CALL                                         !3, 'add'
         42        NEW                                              $26     'DateInterval'
         43        SEND_VAL_EX                                              'PT30M'
         44        DO_FCALL                                      0          
         45        SEND_VAR_NO_REF_EX                                       $26
         46        DO_FCALL                                      0          
   25    47        INIT_METHOD_CALL                                         !3, 'format'
         48        SEND_VAL_EX                                              'Y-m-d+H%3Ai+T'
         49        DO_FCALL                                      0  $29     
         50        CONCAT                                           ~30     $29, '%0A'
         51        ECHO                                                     ~30
   23    52      > JMP                                                      ->40
         53    >   FE_FREE                                                  $25
   26    54      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.74 ms | 1400 KiB | 17 Q