3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date1 = '2000-01-25'; $date2 = '2010-02-20'; $ts1 = strtotime($date1); $ts2 = strtotime($date2); $year1 = date('Y', $ts1); $year2 = date('Y', $ts2); $month1 = date('m', $ts1); $month2 = date('m', $ts2); $diff = (($year2 - $year1) * 12) + ($month2 - $month1); var_dump($diff);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mAsgq
function name:  (null)
number of ops:  39
compiled vars:  !0 = $date1, !1 = $date2, !2 = $ts1, !3 = $ts2, !4 = $year1, !5 = $year2, !6 = $month1, !7 = $month2, !8 = $diff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2000-01-25'
    4     1        ASSIGN                                                   !1, '2010-02-20'
    6     2        INIT_FCALL                                               'strtotime'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $11     
          5        ASSIGN                                                   !2, $11
    7     6        INIT_FCALL                                               'strtotime'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $13     
          9        ASSIGN                                                   !3, $13
    9    10        INIT_FCALL                                               'date'
         11        SEND_VAL                                                 'Y'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $15     
         14        ASSIGN                                                   !4, $15
   10    15        INIT_FCALL                                               'date'
         16        SEND_VAL                                                 'Y'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                         $17     
         19        ASSIGN                                                   !5, $17
   12    20        INIT_FCALL                                               'date'
         21        SEND_VAL                                                 'm'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $19     
         24        ASSIGN                                                   !6, $19
   13    25        INIT_FCALL                                               'date'
         26        SEND_VAL                                                 'm'
         27        SEND_VAR                                                 !3
         28        DO_ICALL                                         $21     
         29        ASSIGN                                                   !7, $21
   15    30        SUB                                              ~23     !5, !4
         31        MUL                                              ~24     ~23, 12
         32        SUB                                              ~25     !7, !6
         33        ADD                                              ~26     ~24, ~25
         34        ASSIGN                                                   !8, ~26
   17    35        INIT_FCALL                                               'var_dump'
         36        SEND_VAR                                                 !8
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.15 ms | 1396 KiB | 19 Q