3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { use TFoo; function test() { var_dump(__METHOD__); $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/2M9PS
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'
   28     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/2M9PS
function name:  test
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'Foo%3A%3Atest'
          2        DO_ICALL                                                 
    7     3        INIT_METHOD_CALL                                         'getFromTrait'
          4        DO_FCALL                                      0          
    8     5      > 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/2M9PS
function name:  some
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > EXIT                                                     'Bar%3A%3Asome'
   14     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/2M9PS
function name:  getFromTrait
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     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
   20     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/2M9PS
function name:  getSomething
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E > > EXIT                                                     'TFoo%3A%3AgetSomething'
   25     1*     > RETURN                                                   null

End of function getsomething

End of class TFoo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.9 ms | 1396 KiB | 15 Q