3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createRange($startDate, $endDate, $format = 'Y-m-d') { $start = new DateTime($startDate); $end = new DateTime($endDate); $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/J620D
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/J620D
function name:  createRange
number of ops:  37
compiled vars:  !0 = $startDate, !1 = $endDate, !2 = $format, !3 = $start, !4 = $end, !5 = $invert, !6 = $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                                              $7      'DateTime'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !3, $7
    4     7        NEW                                              $10     'DateTime'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !4, $10
    5    11        IS_SMALLER                                       ~13     !4, !3
         12        ASSIGN                                                   !5, ~13
    7    13        ASSIGN                                                   !6, <array>
    8    14        INIT_METHOD_CALL                                         !3, 'format'
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0  $17     
         17        ASSIGN_DIM                                               !6
         18        OP_DATA                                                  $17
    9    19      > JMP                                                      ->33
   10    20    >   INIT_METHOD_CALL                                         !3, 'modify'
         21      > JMPZ                                                     !5, ->24
         22    >   QM_ASSIGN                                        ~18     '-'
         23      > JMP                                                      ->25
         24    >   QM_ASSIGN                                        ~18     '%2B'
         25    >   CONCAT                                           ~19     ~18, '1+day'
         26        SEND_VAL_EX                                              ~19
         27        DO_FCALL                                      0          
   11    28        INIT_METHOD_CALL                                         !3, 'format'
         29        SEND_VAR_EX                                              !2
         30        DO_FCALL                                      0  $22     
         31        ASSIGN_DIM                                               !6
         32        OP_DATA                                                  $22
    9    33    >   IS_NOT_EQUAL                                             !3, !4
         34      > JMPNZ                                                    ~23, ->20
   13    35    > > RETURN                                                   !6
   14    36*     > RETURN                                                   null

End of function createrange

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.36 ms | 1403 KiB | 17 Q