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); foreach($datePeriod as $date) { $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
2 jumps found. (Code = 77) Position 1 = 37, Position 2 = 40
Branch analysis from position: 37
2 jumps found. (Code = 78) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/NSAY7
function name:  (null)
number of ops:  57
compiled vars:  !0 = $dateRange, !1 = $parts, !2 = $begin, !3 = $end, !4 = $interval, !5 = $datePeriod, !6 = $periodArray, !7 = $startDate, !8 = $date, !9 = $endDate
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      > FE_RESET_R                                       $31     !5, ->40
         37    > > FE_FETCH_R                                               $31, !8, ->40
   16    38    >   ASSIGN                                                   !9, !8
   15    39      > JMP                                                      ->37
         40    >   FE_FREE                                                  $31
   21    41        INIT_METHOD_CALL                                         !7, 'format'
         42        SEND_VAL_EX                                              'c'
         43        DO_FCALL                                      0  $33     
         44        ECHO                                                     $33
   22    45        ECHO                                                     '%0A'
   26    46        INIT_METHOD_CALL                                         !9, 'format'
         47        SEND_VAL_EX                                              'c'
         48        DO_FCALL                                      0  $34     
         49        ECHO                                                     $34
   27    50        ECHO                                                     '%0A'
   28    51        ECHO                                                     '%0A'
   29    52        INIT_FCALL                                               'print_r'
         53        SEND_VAR                                                 !6
         54        DO_ICALL                                         $35     
         55        ECHO                                                     $35
         56      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.74 ms | 1400 KiB | 21 Q