3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ageByDate($date) { return (new DateTime('now'))->diff(new DateTime($date))->y; } echo ageByDate('1995-11-13');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J5b4A
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'agebydate'
          1        SEND_VAL                                                 '1995-11-13'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function agebydate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J5b4A
function name:  ageByDate
number of ops:  13
compiled vars:  !0 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        NEW                                              $1      'DateTime'
          2        SEND_VAL_EX                                              'now'
          3        DO_FCALL                                      0          
          4        INIT_METHOD_CALL                                         $1, 'diff'
          5        NEW                                              $3      'DateTime'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        SEND_VAR_NO_REF_EX                                       $3
          9        DO_FCALL                                      0  $5      
         10        FETCH_OBJ_R                                      ~6      $5, 'y'
         11      > RETURN                                                   ~6
    5    12*     > RETURN                                                   null

End of function agebydate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.21 ms | 1401 KiB | 14 Q