3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('UTC'); $begin = new DateTime('today midnight'); $end = new DateTime(); $interval = new DateInterval('PT60M'); $interval->invert = 1; $daterange = new DatePeriod($begin, $interval, $end); $range = []; foreach ($daterange as $date){ $range[] = [ 'from' => $date->format("H:i"), 'to' => $date->sub($interval)->format("H:i") ]; } print_r($range);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 39
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 39
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/BMSbI
function name:  (null)
number of ops:  44
compiled vars:  !0 = $begin, !1 = $end, !2 = $interval, !3 = $daterange, !4 = $range, !5 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'UTC'
          2        DO_ICALL                                                 
    4     3        NEW                                              $7      'DateTime'
          4        SEND_VAL_EX                                              'today+midnight'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $7
    5     7        NEW                                              $10     'DateTime'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $10
    7    10        NEW                                              $13     'DateInterval'
         11        SEND_VAL_EX                                              'PT60M'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !2, $13
    8    14        ASSIGN_OBJ                                               !2, 'invert'
         15        OP_DATA                                                  1
    9    16        NEW                                              $17     'DatePeriod'
         17        SEND_VAR_EX                                              !0
         18        SEND_VAR_EX                                              !2
         19        SEND_VAR_EX                                              !1
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !3, $17
   11    22        ASSIGN                                                   !4, <array>
   12    23      > FE_RESET_R                                       $21     !3, ->39
         24    > > FE_FETCH_R                                               $21, !5, ->39
   14    25    >   INIT_METHOD_CALL                                         !5, 'format'
         26        SEND_VAL_EX                                              'H%3Ai'
         27        DO_FCALL                                      0  $23     
         28        INIT_ARRAY                                       ~24     $23, 'from'
   15    29        INIT_METHOD_CALL                                         !5, 'sub'
         30        SEND_VAR_EX                                              !2
         31        DO_FCALL                                      0  $25     
         32        INIT_METHOD_CALL                                         $25, 'format'
         33        SEND_VAL_EX                                              'H%3Ai'
         34        DO_FCALL                                      0  $26     
         35        ADD_ARRAY_ELEMENT                                ~24     $26, 'to'
   13    36        ASSIGN_DIM                                               !4
   15    37        OP_DATA                                                  ~24
   12    38      > JMP                                                      ->24
         39    >   FE_FREE                                                  $21
   19    40        INIT_FCALL                                               'print_r'
         41        SEND_VAR                                                 !4
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.79 ms | 1004 KiB | 15 Q