3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createRange($startDate, $endDate) { $start = new DateTime($startDate); $end = new DateTime($endDate); $interval = new DateInterval('P1D'); if ($start > $end) $interval->invert = 1; $dates = array(); $dates[] = $start->format('Y-m-d'); while ($start != $end) { $start->add($interval); $dates[] = $start->format('Y-m-d'); } return $dates; } $dates = createRange('2010-10-01', '2010-10-03'); print_r($dates);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O9oVX
function name:  (null)
number of ops:  9
compiled vars:  !0 = $dates
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'createrange'
          1        SEND_VAL                                                 '2010-10-01'
          2        SEND_VAL                                                 '2010-10-03'
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   18     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function createrange:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 25
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 25
Branch analysis from position: 35
Branch analysis from position: 25
Branch analysis from position: 18
filename:       /in/O9oVX
function name:  createRange
number of ops:  37
compiled vars:  !0 = $startDate, !1 = $endDate, !2 = $start, !3 = $end, !4 = $interval, !5 = $dates
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        NEW                                              $6      'DateTime'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $6
    4     6        NEW                                              $9      'DateTime'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !3, $9
    5    10        NEW                                              $12     'DateInterval'
         11        SEND_VAL_EX                                              'P1D'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !4, $12
    6    14        IS_SMALLER                                               !3, !2
         15      > JMPZ                                                     ~15, ->18
         16    >   ASSIGN_OBJ                                               !4, 'invert'
         17        OP_DATA                                                  1
    8    18    >   ASSIGN                                                   !5, <array>
    9    19        INIT_METHOD_CALL                                         !2, 'format'
         20        SEND_VAL_EX                                              'Y-m-d'
         21        DO_FCALL                                      0  $19     
         22        ASSIGN_DIM                                               !5
         23        OP_DATA                                                  $19
   10    24      > JMP                                                      ->33
   11    25    >   INIT_METHOD_CALL                                         !2, 'add'
         26        SEND_VAR_EX                                              !4
         27        DO_FCALL                                      0          
   12    28        INIT_METHOD_CALL                                         !2, 'format'
         29        SEND_VAL_EX                                              'Y-m-d'
         30        DO_FCALL                                      0  $22     
         31        ASSIGN_DIM                                               !5
         32        OP_DATA                                                  $22
   10    33    >   IS_NOT_EQUAL                                             !2, !3
         34      > JMPNZ                                                    ~23, ->25
   14    35    > > RETURN                                                   !5
   15    36*     > RETURN                                                   null

End of function createrange

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.46 ms | 1403 KiB | 16 Q