3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date_from1 = new DateTime('1-9-2016'); $date_from=$date_from1->format('Y-m-d'); $date_to1 = new DateTime('30-9-2016'); $date_to=$date_to1->format('Y-m-d'); $diff1=$date_from1->diff($date_to1); $diff2= $diff1->format('%R %a days'); $interval = new DateInterval('P1D'); preg_match_all('!\d+!', $diff2, $matches); //use that to get only number from diff2 for($i=0; $i <= $matches[0][0]; $i++) //$matches return diff2 only number of days { $this_date= $i? $date_from1->add($interval): $date_from1; echo $this_date->format('Y-m-d') . "\r\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 35
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 41
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 35
Branch analysis from position: 53
Branch analysis from position: 35
Branch analysis from position: 41
2 jumps found. (Code = 44) Position 1 = 53, Position 2 = 35
Branch analysis from position: 53
Branch analysis from position: 35
filename:       /in/uA8jU
function name:  (null)
number of ops:  54
compiled vars:  !0 = $date_from1, !1 = $date_from, !2 = $date_to1, !3 = $date_to, !4 = $diff1, !5 = $diff2, !6 = $interval, !7 = $matches, !8 = $i, !9 = $this_date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $10     'DateTime'
          1        SEND_VAL_EX                                              '1-9-2016'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $10
    3     4        INIT_METHOD_CALL                                         !0, 'format'
          5        SEND_VAL_EX                                              'Y-m-d'
          6        DO_FCALL                                      0  $13     
          7        ASSIGN                                                   !1, $13
    4     8        NEW                                              $15     'DateTime'
          9        SEND_VAL_EX                                              '30-9-2016'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $15
    5    12        INIT_METHOD_CALL                                         !2, 'format'
         13        SEND_VAL_EX                                              'Y-m-d'
         14        DO_FCALL                                      0  $18     
         15        ASSIGN                                                   !3, $18
    6    16        INIT_METHOD_CALL                                         !0, 'diff'
         17        SEND_VAR_EX                                              !2
         18        DO_FCALL                                      0  $20     
         19        ASSIGN                                                   !4, $20
    7    20        INIT_METHOD_CALL                                         !4, 'format'
         21        SEND_VAL_EX                                              '%25R+%25a+days'
         22        DO_FCALL                                      0  $22     
         23        ASSIGN                                                   !5, $22
    8    24        NEW                                              $24     'DateInterval'
         25        SEND_VAL_EX                                              'P1D'
         26        DO_FCALL                                      0          
         27        ASSIGN                                                   !6, $24
    9    28        INIT_FCALL                                               'preg_match_all'
         29        SEND_VAL                                                 '%21%5Cd%2B%21'
         30        SEND_VAR                                                 !5
         31        SEND_REF                                                 !7
         32        DO_ICALL                                                 
   10    33        ASSIGN                                                   !8, 0
         34      > JMP                                                      ->49
   12    35    > > JMPZ                                                     !8, ->41
         36    >   INIT_METHOD_CALL                                         !0, 'add'
         37        SEND_VAR_EX                                              !6
         38        DO_FCALL                                      0  $29     
         39        QM_ASSIGN                                        ~30     $29
         40      > JMP                                                      ->42
         41    >   QM_ASSIGN                                        ~30     !0
         42    >   ASSIGN                                                   !9, ~30
   13    43        INIT_METHOD_CALL                                         !9, 'format'
         44        SEND_VAL_EX                                              'Y-m-d'
         45        DO_FCALL                                      0  $32     
         46        CONCAT                                           ~33     $32, '%0D%0A'
         47        ECHO                                                     ~33
   10    48        PRE_INC                                                  !8
         49    >   FETCH_DIM_R                                      ~35     !7, 0
         50        FETCH_DIM_R                                      ~36     ~35, 0
         51        IS_SMALLER_OR_EQUAL                                      !8, ~36
         52      > JMPNZ                                                    ~37, ->35
   14    53    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.62 ms | 1005 KiB | 14 Q