3v4l.org

run code in 300+ PHP versions simultaneously
<?php function daysBetweenDates($startDate, $endDate) { $startDate = new \DateTime($startDate); $endDate = new \DateTime($endDate); return $startDate->diff($endDate)->days; } echo daysBetweenDates('2014-10-14', '2014-10-28');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jfOB6
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'daysbetweendates'
          1        SEND_VAL                                                 '2014-10-14'
          2        SEND_VAL                                                 '2014-10-28'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function daysbetweendates:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jfOB6
function name:  daysBetweenDates
number of ops:  16
compiled vars:  !0 = $startDate, !1 = $endDate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        NEW                                              $2      'DateTime'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
    4     6        NEW                                              $5      'DateTime'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $5
    5    10        INIT_METHOD_CALL                                         !0, 'diff'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0  $8      
         13        FETCH_OBJ_R                                      ~9      $8, 'days'
         14      > RETURN                                                   ~9
    6    15*     > RETURN                                                   null

End of function daysbetweendates

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.24 ms | 1398 KiB | 14 Q