3v4l.org

run code in 500+ PHP versions simultaneously
<?php echo dateDifference('2017-09-29', '2018-11-29'); function dateDifference($date_1 , $date_2 , $differenceFormat = '%y Year(s) %m month(s)') { $datetime1 = date_create($date_1); $datetime2 = date_create($date_2); $interval = date_diff($datetime1, $datetime2); return $interval->format($differenceFormat); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZfCBJ
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL_BY_NAME                                           'dateDifference'
          1        SEND_VAL_EX                                                  '2017-09-29'
          2        SEND_VAL_EX                                                  '2018-11-29'
          3        DO_FCALL                                          0  $0      
          4        ECHO                                                         $0
   12     5      > RETURN                                                       1

Function datedifference:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZfCBJ
function name:  dateDifference
number of ops:  21
compiled vars:  !0 = $date_1, !1 = $date_2, !2 = $differenceFormat, !3 = $datetime1, !4 = $datetime2, !5 = $interval
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV_INIT                                            !2      '%25y+Year%28s%29+%25m+month%28s%29'
    5     3        INIT_FCALL                                                   'date_create'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $6      
          6        ASSIGN                                                       !3, $6
    6     7        INIT_FCALL                                                   'date_create'
          8        SEND_VAR                                                     !1
          9        DO_ICALL                                             $8      
         10        ASSIGN                                                       !4, $8
    8    11        INIT_FCALL                                                   'date_diff'
         12        SEND_VAR                                                     !3
         13        SEND_VAR                                                     !4
         14        DO_ICALL                                             $10     
         15        ASSIGN                                                       !5, $10
   10    16        INIT_METHOD_CALL                                             !5, 'format'
         17        SEND_VAR_EX                                                  !2
         18        DO_FCALL                                          0  $12     
         19      > RETURN                                                       $12
   12    20*     > RETURN                                                       null

End of function datedifference

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.42 ms | 2202 KiB | 15 Q