3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '2018-10-26'; $daysLeft = 4; $startDateObj = new DateTime($string); $endDateObj = new DateTime($string); $endDateObj = $endDateObj->modify('+'.$daysLeft.' days'); $interval = new DateInterval('P'.$daysLeft.'D'); $dateRange = new DatePeriod($startDateObj, $interval, $endDateObj); foreach($dateRange as $date) { echo "1 day!".PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/XsvX0
function name:  (null)
number of ops:  34
compiled vars:  !0 = $string, !1 = $daysLeft, !2 = $startDateObj, !3 = $endDateObj, !4 = $interval, !5 = $dateRange, !6 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '2018-10-26'
    3     1        ASSIGN                                                   !1, 4
    4     2        NEW                                              $9      'DateTime'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $9
    5     6        NEW                                              $12     'DateTime'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !3, $12
    6    10        INIT_METHOD_CALL                                         !3, 'modify'
         11        CONCAT                                           ~15     '%2B', !1
         12        CONCAT                                           ~16     ~15, '+days'
         13        SEND_VAL_EX                                              ~16
         14        DO_FCALL                                      0  $17     
         15        ASSIGN                                                   !3, $17
    7    16        NEW                                              $19     'DateInterval'
         17        CONCAT                                           ~20     'P', !1
         18        CONCAT                                           ~21     ~20, 'D'
         19        SEND_VAL_EX                                              ~21
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !4, $19
    8    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      > FE_RESET_R                                       $27     !5, ->32
         29    > > FE_FETCH_R                                               $27, !6, ->32
   10    30    >   ECHO                                                     '1+day%21%0A'
    9    31      > JMP                                                      ->29
         32    >   FE_FREE                                                  $27
   11    33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.06 ms | 1395 KiB | 13 Q