3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('UTC'); $start = new DateTime('2020-03-08 04:00'); $interval = DateInterval::createFromDateString('-1 hour'); $period = new DatePeriod($start, $interval, 10); foreach ($period as $date) { echo $date->format('Y-m-d h:i a') . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 25
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 25
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/3YflE
function name:  (null)
number of ops:  27
compiled vars:  !0 = $start, !1 = $interval, !2 = $period, !3 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'UTC'
          2        DO_ICALL                                                 
    6     3        NEW                                              $5      'DateTime'
          4        SEND_VAL_EX                                              '2020-03-08+04%3A00'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $5
    7     7        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
          8        SEND_VAL                                                 '-1+hour'
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !1, $8
    9    11        NEW                                              $10     'DatePeriod'
         12        SEND_VAR_EX                                              !0
         13        SEND_VAR_EX                                              !1
         14        SEND_VAL_EX                                              10
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !2, $10
   10    17      > FE_RESET_R                                       $13     !2, ->25
         18    > > FE_FETCH_R                                               $13, !3, ->25
   11    19    >   INIT_METHOD_CALL                                         !3, 'format'
         20        SEND_VAL_EX                                              'Y-m-d+h%3Ai+a'
         21        DO_FCALL                                      0  $14     
         22        CONCAT                                           ~15     $14, '%0A'
         23        ECHO                                                     ~15
   10    24      > JMP                                                      ->18
         25    >   FE_FREE                                                  $13
   12    26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.52 ms | 1002 KiB | 14 Q