3v4l.org

run code in 300+ PHP versions simultaneously
<?php $last = "2018-04-10 20:00:00"; $now = new DateTime(); $last_dt = new DateTime($last); $difference = $last_dt->diff($now); $difference->format('%d'); $num_of_days = $difference->m; echo "Difference: ".$difference->m." months and ".$difference->d." days, or ".$difference->days." in total";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YQVqQ
function name:  (null)
number of ops:  28
compiled vars:  !0 = $last, !1 = $now, !2 = $last_dt, !3 = $difference, !4 = $num_of_days
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2018-04-10+20%3A00%3A00'
    6     1        NEW                                              $6      'DateTime'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $6
    7     4        NEW                                              $9      'DateTime'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $9
    8     8        INIT_METHOD_CALL                                         !2, 'diff'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $12     
         11        ASSIGN                                                   !3, $12
   10    12        INIT_METHOD_CALL                                         !3, 'format'
         13        SEND_VAL_EX                                              '%25d'
         14        DO_FCALL                                      0          
   12    15        FETCH_OBJ_R                                      ~15     !3, 'm'
         16        ASSIGN                                                   !4, ~15
   13    17        FETCH_OBJ_R                                      ~17     !3, 'm'
         18        CONCAT                                           ~18     'Difference%3A+', ~17
         19        CONCAT                                           ~19     ~18, '+months+and+'
         20        FETCH_OBJ_R                                      ~20     !3, 'd'
         21        CONCAT                                           ~21     ~19, ~20
         22        CONCAT                                           ~22     ~21, '+days%2C+or+'
         23        FETCH_OBJ_R                                      ~23     !3, 'days'
         24        CONCAT                                           ~24     ~22, ~23
         25        CONCAT                                           ~25     ~24, '+in+total'
         26        ECHO                                                     ~25
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.88 ms | 1398 KiB | 13 Q