3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait TestTrait { public $test = __FUNCTION__; public function getFuncName() { return $test; } } class A { use TestTrait; public function testTraitFunc() { echo $this->getFuncName(); } } $a = new A(); $a->testTraitFunc();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s85Pl
function name:  (null)
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   DECLARE_CLASS                                            'a'
   25     1        NEW                                              $1      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   26     4        INIT_METHOD_CALL                                         !0, 'testTraitFunc'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class TestTrait:
Function getfuncname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s85Pl
function name:  getFuncName
number of ops:  2
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E > > RETURN                                                   !0
   10     1*     > RETURN                                                   null

End of function getfuncname

End of class TestTrait.

Class A:
Function testtraitfunc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s85Pl
function name:  testTraitFunc
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_METHOD_CALL                                         'getFuncName'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   20     3      > RETURN                                                   null

End of function testtraitfunc

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.05 ms | 1394 KiB | 13 Q