3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date1 = new DateTime('2010-01-25'); $date2 = new DateTime('2010-02-20'); $interval = $date2->diff($date1); $months = ($interval->y * 12) + $interval->m; $months += number_format($interval->d / 30, 1); echo $months;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f6n3r
function name:  (null)
number of ops:  26
compiled vars:  !0 = $date1, !1 = $date2, !2 = $interval, !3 = $months
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $4      'DateTime'
          1        SEND_VAL_EX                                              '2010-01-25'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
    3     4        NEW                                              $7      'DateTime'
          5        SEND_VAL_EX                                              '2010-02-20'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
    5     8        INIT_METHOD_CALL                                         !1, 'diff'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $10     
         11        ASSIGN                                                   !2, $10
    7    12        FETCH_OBJ_R                                      ~12     !2, 'y'
         13        MUL                                              ~13     ~12, 12
         14        FETCH_OBJ_R                                      ~14     !2, 'm'
         15        ADD                                              ~15     ~13, ~14
         16        ASSIGN                                                   !3, ~15
    8    17        INIT_FCALL                                               'number_format'
         18        FETCH_OBJ_R                                      ~17     !2, 'd'
         19        DIV                                              ~18     ~17, 30
         20        SEND_VAL                                                 ~18
         21        SEND_VAL                                                 1
         22        DO_ICALL                                         $19     
         23        ASSIGN_OP                                     1          !3, $19
   10    24        ECHO                                                     !3
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.99 ms | 1406 KiB | 15 Q