3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyInterval extends DateInterval { public static function instance(DateInterval $di) { return new static($di->spec()); } } $diff = (new DateTime('yesterday'))->diff(new DateTime('tomorrow')); $myDiff = MyInterval::instance($diff); var_dump($myDiff);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/M0oXl
function name:  (null)
number of ops:  18
compiled vars:  !0 = $diff, !1 = $myDiff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $2      'DateTime'
          1        SEND_VAL_EX                                              'yesterday'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $2, 'diff'
          4        NEW                                              $4      'DateTime'
          5        SEND_VAL_EX                                              'tomorrow'
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $4
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !0, $6
   13    10        INIT_STATIC_METHOD_CALL                                  'MyInterval', 'instance'
         11        SEND_VAR                                                 !0
         12        DO_FCALL                                      0  $8      
         13        ASSIGN                                                   !1, $8
   15    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Class MyInterval:
Function instance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/M0oXl
function name:  instance
number of ops:  8
compiled vars:  !0 = $di
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        NEW                          static              $1      
          2        INIT_METHOD_CALL                                         !0, 'spec'
          3        DO_FCALL                                      0  $2      
          4        SEND_VAR_NO_REF_EX                                       $2
          5        DO_FCALL                                      0          
          6      > RETURN                                                   $1
    8     7*     > RETURN                                                   null

End of function instance

End of class MyInterval.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.37 ms | 1400 KiB | 15 Q