3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dates = array( "2016-02-01", "2016-03-01", "2016-04-01", "2016-05-01", "2016-06-01", "2016-07-01", "2016-09-01", "2016-11-01", "2016-12-01", "2017-01-01", "2017-12-01" ); $datez = array(); $date = array(); $datez[] = 0; for($i = 1; $i < count($dates) - 1; $i++){ $start_date = $dates[$i-1]; $end_Date = $dates[$i]; $date1 = new DateTime($start_date); $date2 = new DateTime($end_Date); $interval = $date1->diff($date2); $date[] = $interval->days; $datez[] = array_sum($date); } print_r($date); print_r($datez);
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 = 37, Position 2 = 7
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 7
Branch analysis from position: 37
Branch analysis from position: 7
filename:       /in/tQTic
function name:  (null)
number of ops:  44
compiled vars:  !0 = $dates, !1 = $datez, !2 = $date, !3 = $i, !4 = $start_date, !5 = $end_Date, !6 = $date1, !7 = $date2, !8 = $interval
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   16     1        ASSIGN                                                   !1, <array>
   17     2        ASSIGN                                                   !2, <array>
   18     3        ASSIGN_DIM                                               !1
          4        OP_DATA                                                  0
   20     5        ASSIGN                                                   !3, 1
          6      > JMP                                                      ->33
   21     7    >   SUB                                              ~14     !3, 1
          8        FETCH_DIM_R                                      ~15     !0, ~14
          9        ASSIGN                                                   !4, ~15
   22    10        FETCH_DIM_R                                      ~17     !0, !3
         11        ASSIGN                                                   !5, ~17
   24    12        NEW                                              $19     'DateTime'
         13        SEND_VAR_EX                                              !4
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !6, $19
   25    16        NEW                                              $22     'DateTime'
         17        SEND_VAR_EX                                              !5
         18        DO_FCALL                                      0          
         19        ASSIGN                                                   !7, $22
   26    20        INIT_METHOD_CALL                                         !6, 'diff'
         21        SEND_VAR_EX                                              !7
         22        DO_FCALL                                      0  $25     
         23        ASSIGN                                                   !8, $25
   28    24        FETCH_OBJ_R                                      ~28     !8, 'days'
         25        ASSIGN_DIM                                               !2
         26        OP_DATA                                                  ~28
   29    27        INIT_FCALL                                               'array_sum'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $30     
         30        ASSIGN_DIM                                               !1
         31        OP_DATA                                                  $30
   20    32        PRE_INC                                                  !3
         33    >   COUNT                                            ~32     !0
         34        SUB                                              ~33     ~32, 1
         35        IS_SMALLER                                               !3, ~33
         36      > JMPNZ                                                    ~34, ->7
   32    37    >   INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !2
         39        DO_ICALL                                                 
   33    40        INIT_FCALL                                               'print_r'
         41        SEND_VAR                                                 !1
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.78 ms | 1016 KiB | 15 Q