3v4l.org

run code in 300+ PHP versions simultaneously
<?php $d1 = new \Datetime('2017-6-1'); $d2 = new \Datetime('2017-8-1'); $diff = $d1->diff($d2); echo sprintf('%d Months', $diff->m) . PHP_EOL; echo sprintf('and %d Days', $diff->d) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GQB4O
function name:  (null)
number of ops:  27
compiled vars:  !0 = $d1, !1 = $d2, !2 = $diff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'Datetime'
          1        SEND_VAL_EX                                              '2017-6-1'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
    4     4        NEW                                              $6      'Datetime'
          5        SEND_VAL_EX                                              '2017-8-1'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $6
    6     8        INIT_METHOD_CALL                                         !0, 'diff'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $9      
         11        ASSIGN                                                   !2, $9
    8    12        INIT_FCALL                                               'sprintf'
         13        SEND_VAL                                                 '%25d+Months'
         14        FETCH_OBJ_R                                      ~11     !2, 'm'
         15        SEND_VAL                                                 ~11
         16        DO_ICALL                                         $12     
         17        CONCAT                                           ~13     $12, '%0A'
         18        ECHO                                                     ~13
    9    19        INIT_FCALL                                               'sprintf'
         20        SEND_VAL                                                 'and+%25d+Days'
         21        FETCH_OBJ_R                                      ~14     !2, 'd'
         22        SEND_VAL                                                 ~14
         23        DO_ICALL                                         $15     
         24        CONCAT                                           ~16     $15, '%0A'
         25        ECHO                                                     ~16
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.86 ms | 992 KiB | 14 Q