3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Generates a range of dates */ function dateRange( $first, $last, $step = '+1 day', $format = 'l jS F Y' ) { $dates = array(); $current = strtotime( $first ); $last = strtotime( $last ); while( $current <= $last ) { $dates[] = date( $format, $current ); $current = strtotime( $step, $current ); } return $dates; } $Event_Date = '2015-08-09'; $Event_End_Date = '2015-08-19'; $availability_range = array(); $date_start = date('l jS F Y',strtotime($Event_Date)); $date_end = date('l jS F Y',strtotime($Event_End_Date)); $range = dateRange( $date_start, $date_end ); foreach ($range as $key => $date) { array_push($availability_range, $date); } print_r( $availability_range); foreach ($availability_range as $key => $date) { echo $date . ' ----'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 32
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 32
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 32
2 jumps found. (Code = 77) Position 1 = 37, Position 2 = 42
Branch analysis from position: 37
2 jumps found. (Code = 78) Position 1 = 38, Position 2 = 42
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
Branch analysis from position: 32
filename:       /in/Luio5
function name:  (null)
number of ops:  44
compiled vars:  !0 = $Event_Date, !1 = $Event_End_Date, !2 = $availability_range, !3 = $date_start, !4 = $date_end, !5 = $range, !6 = $date, !7 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, '2015-08-09'
   15     1        ASSIGN                                                   !1, '2015-08-19'
   16     2        ASSIGN                                                   !2, <array>
   18     3        INIT_FCALL                                               'date'
          4        SEND_VAL                                                 'l+jS+F+Y'
          5        INIT_FCALL                                               'strtotime'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $11     
          8        SEND_VAR                                                 $11
          9        DO_ICALL                                         $12     
         10        ASSIGN                                                   !3, $12
   19    11        INIT_FCALL                                               'date'
         12        SEND_VAL                                                 'l+jS+F+Y'
         13        INIT_FCALL                                               'strtotime'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $14     
         16        SEND_VAR                                                 $14
         17        DO_ICALL                                         $15     
         18        ASSIGN                                                   !4, $15
   21    19        INIT_FCALL                                               'daterange'
         20        SEND_VAR                                                 !3
         21        SEND_VAR                                                 !4
         22        DO_FCALL                                      0  $17     
         23        ASSIGN                                                   !5, $17
   22    24      > FE_RESET_R                                       $19     !5, ->32
         25    > > FE_FETCH_R                                       ~20     $19, !6, ->32
         26    >   ASSIGN                                                   !7, ~20
   23    27        INIT_FCALL                                               'array_push'
         28        SEND_REF                                                 !2
         29        SEND_VAR                                                 !6
         30        DO_ICALL                                                 
   22    31      > JMP                                                      ->25
         32    >   FE_FREE                                                  $19
   25    33        INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !2
         35        DO_ICALL                                                 
   26    36      > FE_RESET_R                                       $24     !2, ->42
         37    > > FE_FETCH_R                                       ~25     $24, !6, ->42
         38    >   ASSIGN                                                   !7, ~25
   27    39        CONCAT                                           ~27     !6, '+----'
         40        ECHO                                                     ~27
   26    41      > JMP                                                      ->37
         42    >   FE_FREE                                                  $24
   28    43      > RETURN                                                   1

Function daterange:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 14
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 14
Branch analysis from position: 27
Branch analysis from position: 14
filename:       /in/Luio5
function name:  dateRange
number of ops:  29
compiled vars:  !0 = $first, !1 = $last, !2 = $step, !3 = $format, !4 = $dates, !5 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      '%2B1+day'
          3        RECV_INIT                                        !3      'l+jS+F+Y'
    5     4        ASSIGN                                                   !4, <array>
    6     5        INIT_FCALL                                               'strtotime'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !5, $7
    7     9        INIT_FCALL                                               'strtotime'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !1, $9
    8    13      > JMP                                                      ->25
    9    14    >   INIT_FCALL                                               'date'
         15        SEND_VAR                                                 !3
         16        SEND_VAR                                                 !5
         17        DO_ICALL                                         $12     
         18        ASSIGN_DIM                                               !4
         19        OP_DATA                                                  $12
   10    20        INIT_FCALL                                               'strtotime'
         21        SEND_VAR                                                 !2
         22        SEND_VAR                                                 !5
         23        DO_ICALL                                         $13     
         24        ASSIGN                                                   !5, $13
    8    25    >   IS_SMALLER_OR_EQUAL                                      !5, !1
         26      > JMPNZ                                                    ~15, ->14
   12    27    > > RETURN                                                   !4
   13    28*     > RETURN                                                   null

End of function daterange

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.54 ms | 1403 KiB | 22 Q