3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface TestInterface { public function test(): TestInterface; } trait TestTrait { public function test(): TestInterface { return $this; } } class TestClass implements TestInterface { use TestTrait; public function test2() : self { return $this; } } $test = new TestClass; var_dump($test->test(), $this->test2());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EtXqB
function name:  (null)
number of ops:  14
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_CLASS                                            'testclass'
   20     1        NEW                                              $1      'TestClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   21     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'test'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        FETCH_THIS                                       $5      
          9        INIT_METHOD_CALL                                         $5, 'test2'
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

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

End of function test

End of class TestInterface.

Class TestTrait:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EtXqB
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_THIS                                       ~0      
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
    9     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function test

End of class TestTrait.

Class TestClass:
Function test2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EtXqB
function name:  test2
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_THIS                                       ~0      
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   17     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function test2

End of class TestClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.27 ms | 1396 KiB | 15 Q