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)); print "$date_diff"; $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/Ye1FV
function name:  (null)
number of ops:  53
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
    6    13        CAST                                          6  ~13     !2
         14        ECHO                                                     ~13
    8    15        INIT_FCALL                                               'floor'
         16        DIV                                              ~14     !2, 31536000
         17        SEND_VAL                                                 ~14
         18        DO_ICALL                                         $15     
         19        ASSIGN                                                   !3, $15
    9    20        INIT_FCALL                                               'floor'
         21        MUL                                              ~17     !3, 365
         22        MUL                                              ~18     ~17, 60
         23        MUL                                              ~19     ~18, 60
         24        MUL                                              ~20     ~19, 24
         25        SUB                                              ~21     !2, ~20
         26        DIV                                              ~22     ~21, 2592000
         27        SEND_VAL                                                 ~22
         28        DO_ICALL                                         $23     
         29        ASSIGN                                                   !4, $23
   10    30        INIT_FCALL                                               'floor'
         31        MUL                                              ~25     !3, 365
         32        MUL                                              ~26     ~25, 60
         33        MUL                                              ~27     ~26, 60
         34        MUL                                              ~28     ~27, 24
         35        SUB                                              ~29     !2, ~28
         36        MUL                                              ~30     !4, 30
         37        MUL                                              ~31     ~30, 60
         38        MUL                                              ~32     ~31, 60
         39        MUL                                              ~33     ~32, 24
         40        SUB                                              ~34     ~29, ~33
         41        DIV                                              ~35     ~34, 86400
         42        SEND_VAL                                                 ~35
         43        DO_ICALL                                         $36     
         44        ASSIGN                                                   !5, $36
   12    45        INIT_FCALL                                               'printf'
         46        SEND_VAL                                                 '%25d+years%2C+%25d+months%2C+%25d+days'
         47        SEND_VAR                                                 !3
         48        SEND_VAR                                                 !4
         49        SEND_VAR                                                 !5
         50        DO_ICALL                                                 
   13    51        ECHO                                                     '++%0A-+See+more+at%3A+http%3A%2F%2Fwww.w3resource.com%2Fphp-exercises%2Fphp-date-exercises.php%23sthash.xJA52BEw.dpuf'
   14    52      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.02 ms | 1405 KiB | 21 Q