3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dateRange = '2014-01-01 - 2014-01-08'; $parts = explode(' - ', $dateRange); $begin = new \DateTime($parts[0]); $end = new \DateTime($parts[1]); $interval = new \DateInterval('P1D'); $datePeriod = new \DatePeriod($begin, $interval, $end); $periodArray = iterator_to_array($datePeriod); /*$startDate = reset($periodArray); $endDate = end($periodArray);*/ $startDate = current($datePeriod); while($date = next($datePeriod)) { $endDate = $date; } #echo $datePeriod->start->format('c'); #echo "\n"; echo $startDate->format('c'); echo "\n"; #echo "\n"; #echo $datePeriod->end->format('c'); #echo "\n"; echo $endDate->format('c'); echo "\n"; echo "\n"; echo print_r($periodArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 37
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 37
Branch analysis from position: 43
Branch analysis from position: 37
filename:       /in/TsKdj
function name:  (null)
number of ops:  59
compiled vars:  !0 = $dateRange, !1 = $parts, !2 = $begin, !3 = $end, !4 = $interval, !5 = $datePeriod, !6 = $periodArray, !7 = $startDate, !8 = $endDate, !9 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '2014-01-01+-+2014-01-08'
    3     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '+-+'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $11     
          5        ASSIGN                                                   !1, $11
    4     6        NEW                                              $13     'DateTime'
          7        CHECK_FUNC_ARG                                           
          8        FETCH_DIM_FUNC_ARG                               $14     !1, 0
          9        SEND_FUNC_ARG                                            $14
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $13
    5    12        NEW                                              $17     'DateTime'
         13        CHECK_FUNC_ARG                                           
         14        FETCH_DIM_FUNC_ARG                               $18     !1, 1
         15        SEND_FUNC_ARG                                            $18
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !3, $17
    6    18        NEW                                              $21     'DateInterval'
         19        SEND_VAL_EX                                              'P1D'
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !4, $21
    7    22        NEW                                              $24     'DatePeriod'
         23        SEND_VAR_EX                                              !2
         24        SEND_VAR_EX                                              !4
         25        SEND_VAR_EX                                              !3
         26        DO_FCALL                                      0          
         27        ASSIGN                                                   !5, $24
    9    28        INIT_FCALL                                               'iterator_to_array'
         29        SEND_VAR                                                 !5
         30        DO_ICALL                                         $27     
         31        ASSIGN                                                   !6, $27
   14    32        INIT_FCALL                                               'current'
         33        SEND_VAR                                                 !5
         34        DO_ICALL                                         $29     
         35        ASSIGN                                                   !7, $29
   15    36      > JMP                                                      ->38
   16    37    >   ASSIGN                                                   !8, !9
   15    38    >   INIT_FCALL                                               'next'
         39        SEND_REF                                                 !5
         40        DO_ICALL                                         $32     
         41        ASSIGN                                           ~33     !9, $32
         42      > JMPNZ                                                    ~33, ->37
   21    43    >   INIT_METHOD_CALL                                         !7, 'format'
         44        SEND_VAL_EX                                              'c'
         45        DO_FCALL                                      0  $34     
         46        ECHO                                                     $34
   22    47        ECHO                                                     '%0A'
   26    48        INIT_METHOD_CALL                                         !8, 'format'
         49        SEND_VAL_EX                                              'c'
         50        DO_FCALL                                      0  $35     
         51        ECHO                                                     $35
   27    52        ECHO                                                     '%0A'
   28    53        ECHO                                                     '%0A'
   29    54        INIT_FCALL                                               'print_r'
         55        SEND_VAR                                                 !6
         56        DO_ICALL                                         $36     
         57        ECHO                                                     $36
         58      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.88 ms | 1400 KiB | 23 Q