3v4l.org

run code in 500+ PHP versions simultaneously
<?php function createRange($start, $end, $format = 'Y-m-d') { $start = new DateTime($start); $end = new DateTime($end); $invert = $start > $end; $dates = array(); $dates[] = $start->format($format); while ($start != $end) { $start->modify(($invert ? '-' : '+') . '1 day'); $dates[] = $start->format($format); } return $dates; } print_r(createRange('2010-10-01', '2010-10-05')); print_r(createRange('2010-10-05', '2010-10-01', 'j M Y'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MieS1
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                                   'print_r'
          1        INIT_FCALL                                                   'createrange'
          2        SEND_VAL                                                     '2010-10-01'
          3        SEND_VAL                                                     '2010-10-05'
          4        DO_FCALL                                          0  $0      
          5        SEND_VAR                                                     $0
          6        DO_ICALL                                                     
   17     7        INIT_FCALL                                                   'print_r'
          8        INIT_FCALL                                                   'createrange'
          9        SEND_VAL                                                     '2010-10-05'
         10        SEND_VAL                                                     '2010-10-01'
         11        SEND_VAL                                                     'j+M+Y'
         12        DO_FCALL                                          0  $2      
         13        SEND_VAR                                                     $2
         14        DO_ICALL                                                     
         15      > RETURN                                                       1

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

End of function createrange

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
154.84 ms | 2899 KiB | 16 Q