3v4l.org

run code in 300+ PHP versions simultaneously
<?php function daysBetweenDates($startDate, $endDate) { list($year1, $month1, $day1) = explode('-', $startDate); list($year2, $month2, $day2) = explode('-', $endDate); $f = mktime(0, 0, 0, $month2, $day2, $year2); $i = mktime(0, 0, 0, $month1, $day1, $year1); $difference = $f - $i; $days = floor($difference/86400); return $days; } $startDate = '2014-10-14'; $endDate = '2014-10-28'; print_r(daysBetweenDates($startDate, $endDate));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s4OrJ
function name:  (null)
number of ops:  10
compiled vars:  !0 = $startDate, !1 = $endDate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, '2014-10-14'
   13     1        ASSIGN                                                   !1, '2014-10-28'
   14     2        INIT_FCALL                                               'print_r'
          3        INIT_FCALL                                               'daysbetweendates'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function daysbetweendates:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s4OrJ
function name:  daysBetweenDates
number of ops:  51
compiled vars:  !0 = $startDate, !1 = $endDate, !2 = $year1, !3 = $month1, !4 = $day1, !5 = $year2, !6 = $month2, !7 = $day2, !8 = $f, !9 = $i, !10 = $difference, !11 = $days
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '-'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $12     
          6        FETCH_LIST_R                                     $13     $12, 0
          7        ASSIGN                                                   !2, $13
          8        FETCH_LIST_R                                     $15     $12, 1
          9        ASSIGN                                                   !3, $15
         10        FETCH_LIST_R                                     $17     $12, 2
         11        ASSIGN                                                   !4, $17
         12        FREE                                                     $12
    4    13        INIT_FCALL                                               'explode'
         14        SEND_VAL                                                 '-'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $19     
         17        FETCH_LIST_R                                     $20     $19, 0
         18        ASSIGN                                                   !5, $20
         19        FETCH_LIST_R                                     $22     $19, 1
         20        ASSIGN                                                   !6, $22
         21        FETCH_LIST_R                                     $24     $19, 2
         22        ASSIGN                                                   !7, $24
         23        FREE                                                     $19
    5    24        INIT_FCALL                                               'mktime'
         25        SEND_VAL                                                 0
         26        SEND_VAL                                                 0
         27        SEND_VAL                                                 0
         28        SEND_VAR                                                 !6
         29        SEND_VAR                                                 !7
         30        SEND_VAR                                                 !5
         31        DO_ICALL                                         $26     
         32        ASSIGN                                                   !8, $26
    6    33        INIT_FCALL                                               'mktime'
         34        SEND_VAL                                                 0
         35        SEND_VAL                                                 0
         36        SEND_VAL                                                 0
         37        SEND_VAR                                                 !3
         38        SEND_VAR                                                 !4
         39        SEND_VAR                                                 !2
         40        DO_ICALL                                         $28     
         41        ASSIGN                                                   !9, $28
    7    42        SUB                                              ~30     !8, !9
         43        ASSIGN                                                   !10, ~30
    8    44        INIT_FCALL                                               'floor'
         45        DIV                                              ~32     !10, 86400
         46        SEND_VAL                                                 ~32
         47        DO_ICALL                                         $33     
         48        ASSIGN                                                   !11, $33
    9    49      > RETURN                                                   !11
   10    50*     > RETURN                                                   null

End of function daysbetweendates

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.32 ms | 1402 KiB | 22 Q