3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait Feature { public function getClass() { $func = function (self $instance) { print get_class($instance); }; $func($this); } } class Foo { use Feature; } class Bar { use Feature; } (new Foo)->getClass(); (new Bar)->getClass();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oKeSG
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   DECLARE_CLASS                                                'foo'
   19     1        DECLARE_CLASS                                                'bar'
   25     2        NEW                                                  $0      'Foo'
          3        DO_FCALL                                          0          
          4        INIT_METHOD_CALL                                             $0, 'getClass'
          5        DO_FCALL                                          0          
   26     6        NEW                                                  $3      'Bar'
          7        DO_FCALL                                          0          
          8        INIT_METHOD_CALL                                             $3, 'getClass'
          9        DO_FCALL                                          0          
         10      > RETURN                                                       1

Class Feature:
Function getclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oKeSG
function name:  getClass
number of ops:  7
compiled vars:  !0 = $func
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   DECLARE_LAMBDA_FUNCTION                              ~1      [0]
          1        ASSIGN                                                       !0, ~1
   10     2        INIT_DYNAMIC_CALL                                            !0
          3        FETCH_THIS                                           $3      
          4        SEND_VAR_EX                                                  $3
          5        DO_FCALL                                          0          
   11     6      > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oKeSG
function name:  {closure:Feature::getClass():6}
number of ops:  4
compiled vars:  !0 = $instance
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    7     1        GET_CLASS                                            ~1      !0
          2        ECHO                                                         ~1
    8     3      > RETURN                                                       null

End of Dynamic Function 0

End of function getclass

End of class Feature.

Class Foo: [no user functions]
Class Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
150.92 ms | 1553 KiB | 8 Q