3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Sample Dates : 1981-11-03, 2013-09-04 Expected Result : Difference : 31 years, 10 months, 1 days - See more at: */ echo date_create('1981-11-03'); class Calculate { public function diff_cal($datetime1, $datetime2) { $interval = date_diff($datetime1, $datetime2); return $interval; } } $cal = New Calculate; $cal->diff_cal('1981-11-03','2013-09-04');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d78AJ
function name:  (null)
number of ops:  12
compiled vars:  !0 = $cal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'date_create'
          1        SEND_VAL                                                 '1981-11-03'
          2        DO_ICALL                                         $1      
          3        ECHO                                                     $1
   16     4        NEW                                              $2      'Calculate'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   17     7        INIT_METHOD_CALL                                         !0, 'diff_cal'
          8        SEND_VAL_EX                                              '1981-11-03'
          9        SEND_VAL_EX                                              '2013-09-04'
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Class Calculate:
Function diff_cal:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d78AJ
function name:  diff_cal
number of ops:  9
compiled vars:  !0 = $datetime1, !1 = $datetime2, !2 = $interval
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        INIT_FCALL                                               'date_diff'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !2, $3
   12     7      > RETURN                                                   !2
   13     8*     > RETURN                                                   null

End of function diff_cal

End of class Calculate.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.82 ms | 1395 KiB | 17 Q