3v4l.org

run code in 300+ PHP versions simultaneously
<?php $datetime1 = new DateTime(); $datetime2 = new DateTime('2013-01-03 17:13:00'); $interval = $datetime1->diff($datetime2); $elapsed = $interval->format('%y years, %m months, %a days, %h hours, %i minutes, %S seconds'); $elapsed = str_replace(array('0 years,', ' 0 months,', ' 0 days,', ' 0 hours,', ' 0 minutes,'), '', $elapsed); $elapsed = str_replace(array('1 years, ', ' 1 months, ', ' 1 days, ', ' 1 hours, ', ' 1 minutes'), array('1 year, ', '1 month, ', ' 1 day, ', ' 1 hour, ', ' 1 minute'), $elapsed); echo $elapsed;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Me5IT
function name:  (null)
number of ops:  29
compiled vars:  !0 = $datetime1, !1 = $datetime2, !2 = $interval, !3 = $elapsed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $4      'DateTime'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    3     3        NEW                                              $7      'DateTime'
          4        SEND_VAL_EX                                              '2013-01-03+17%3A13%3A00'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $7
    4     7        INIT_METHOD_CALL                                         !0, 'diff'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0  $10     
         10        ASSIGN                                                   !2, $10
    5    11        INIT_METHOD_CALL                                         !2, 'format'
         12        SEND_VAL_EX                                              '%25y+years%2C+%25m+months%2C+%25a+days%2C+%25h+hours%2C+%25i+minutes%2C+%25S+seconds'
         13        DO_FCALL                                      0  $12     
         14        ASSIGN                                                   !3, $12
    6    15        INIT_FCALL                                               'str_replace'
         16        SEND_VAL                                                 <array>
         17        SEND_VAL                                                 ''
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $14     
         20        ASSIGN                                                   !3, $14
    7    21        INIT_FCALL                                               'str_replace'
         22        SEND_VAL                                                 <array>
         23        SEND_VAL                                                 <array>
         24        SEND_VAR                                                 !3
         25        DO_ICALL                                         $16     
         26        ASSIGN                                                   !3, $16
    8    27        ECHO                                                     !3
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.27 ms | 1443 KiB | 14 Q