3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { use TFoo; function test() { $this->getFromTrait(); } } class Bar { function some() { die(__METHOD__); } } trait TFoo { function getFromTrait() { return new Bar($this->getSomething()); } function getSomething() { // Must be called!!! die(__METHOD__); } } (new Foo())->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t3MHW
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'foo'
   27     1        NEW                                              $0      'Foo'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $0, 'test'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class Foo:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t3MHW
function name:  test
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_METHOD_CALL                                         'getFromTrait'
          1        DO_FCALL                                      0          
    7     2      > RETURN                                                   null

End of function test

End of class Foo.

Class Bar:
Function some:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/t3MHW
function name:  some
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > EXIT                                                     'Bar%3A%3Asome'
   13     1*     > RETURN                                                   null

End of function some

End of class Bar.

Class TFoo:
Function getfromtrait:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t3MHW
function name:  getFromTrait
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $0      'Bar'
          1        INIT_METHOD_CALL                                         'getSomething'
          2        DO_FCALL                                      0  $1      
          3        SEND_VAR_NO_REF_EX                                       $1
          4        DO_FCALL                                      0          
          5      > RETURN                                                   $0
   19     6*     > RETURN                                                   null

End of function getfromtrait

Function getsomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/t3MHW
function name:  getSomething
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E > > EXIT                                                     'TFoo%3A%3AgetSomething'
   24     1*     > RETURN                                                   null

End of function getsomething

End of class TFoo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.54 ms | 1395 KiB | 13 Q