3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sdate = "1981-11-04"; $edate = "2013-09-04"; $date_diff = abs(strtotime($edate) - strtotime($sdate)); $years = floor($date_diff / (365*60*60*24)); $months = floor(($date_diff - $years * 365*60*60*24) / (30*60*60*24)); $days = floor(($date_diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); printf("%d years, %d months, %d days", $years, $months, $days); ?> - See more at: http://www.w3resource.com/php-exercises/php-date-exercises.php#sthash.xJA52BEw.dpuf
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ua2Hu
function name:  (null)
number of ops:  51
compiled vars:  !0 = $sdate, !1 = $edate, !2 = $date_diff, !3 = $years, !4 = $months, !5 = $days
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '1981-11-04'
    3     1        ASSIGN                                                   !1, '2013-09-04'
    5     2        INIT_FCALL                                               'abs'
          3        INIT_FCALL                                               'strtotime'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $8      
          6        INIT_FCALL                                               'strtotime'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $9      
          9        SUB                                              ~10     $8, $9
         10        SEND_VAL                                                 ~10
         11        DO_ICALL                                         $11     
         12        ASSIGN                                                   !2, $11
    7    13        INIT_FCALL                                               'floor'
         14        DIV                                              ~13     !2, 31536000
         15        SEND_VAL                                                 ~13
         16        DO_ICALL                                         $14     
         17        ASSIGN                                                   !3, $14
    8    18        INIT_FCALL                                               'floor'
         19        MUL                                              ~16     !3, 365
         20        MUL                                              ~17     ~16, 60
         21        MUL                                              ~18     ~17, 60
         22        MUL                                              ~19     ~18, 24
         23        SUB                                              ~20     !2, ~19
         24        DIV                                              ~21     ~20, 2592000
         25        SEND_VAL                                                 ~21
         26        DO_ICALL                                         $22     
         27        ASSIGN                                                   !4, $22
    9    28        INIT_FCALL                                               'floor'
         29        MUL                                              ~24     !3, 365
         30        MUL                                              ~25     ~24, 60
         31        MUL                                              ~26     ~25, 60
         32        MUL                                              ~27     ~26, 24
         33        SUB                                              ~28     !2, ~27
         34        MUL                                              ~29     !4, 30
         35        MUL                                              ~30     ~29, 60
         36        MUL                                              ~31     ~30, 60
         37        MUL                                              ~32     ~31, 24
         38        SUB                                              ~33     ~28, ~32
         39        DIV                                              ~34     ~33, 86400
         40        SEND_VAL                                                 ~34
         41        DO_ICALL                                         $35     
         42        ASSIGN                                                   !5, $35
   11    43        INIT_FCALL                                               'printf'
         44        SEND_VAL                                                 '%25d+years%2C+%25d+months%2C+%25d+days'
         45        SEND_VAR                                                 !3
         46        SEND_VAR                                                 !4
         47        SEND_VAR                                                 !5
         48        DO_ICALL                                                 
   12    49        ECHO                                                     '++%0A-+See+more+at%3A+http%3A%2F%2Fwww.w3resource.com%2Fphp-exercises%2Fphp-date-exercises.php%23sthash.xJA52BEw.dpuf'
   13    50      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.26 ms | 1400 KiB | 21 Q