3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait Test1 { public function test1() { echo $this->test; } } trait Test2 { public function test2() { echo $this->test; } } class Foo { private $test = "bar"; use Test1; } class Bar extends Foo { use Test2; } (new Foo())->test1(); (new Bar())->test1(); (new Bar())->test2();
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/VKYQK
function name:  (null)
number of ops:  22
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  11     1        NOP                                                      
  19     2        DECLARE_CLASS                                    $2      '%00foo%2Fin%2FVKYQK0x7f93033b10e3', 'foo'
  22     3        ADD_TRAIT                                                $2, 'Test1'
  19     4        BIND_TRAITS                                              $2
  25     5        FETCH_CLASS                                   0  :3      'Foo'
         6        DECLARE_INHERITED_CLASS                          $4      '%00bar%2Fin%2FVKYQK0x7f93033b110d', 'bar'
  27     7        ADD_TRAIT                                                $4, 'Test2'
  25     8        BIND_TRAITS                                              $4
  30     9        NEW                                              $5      :4
        10        DO_FCALL                                      0          
        11        INIT_METHOD_CALL                                         $5, 'test1'
        12        DO_FCALL                                      0          
  31    13        NEW                                              $8      :8
        14        DO_FCALL                                      0          
        15        INIT_METHOD_CALL                                         $8, 'test1'
        16        DO_FCALL                                      0          
  32    17        NEW                                              $11     :12
        18        DO_FCALL                                      0          
        19        INIT_METHOD_CALL                                         $11, 'test2'
        20        DO_FCALL                                      0          
        21      > RETURN                                                   1

Class Test1:
Function test1:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/VKYQK
function name:  test1
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   7     0  E >   FETCH_OBJ_R                                      $0      'test'
         1        ECHO                                                     $0
   8     2      > RETURN                                                   null

End of function test1

End of class Test1.

Class Test2:
Function test2:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/VKYQK
function name:  test2
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  15     0  E >   FETCH_OBJ_R                                      $0      'test'
         1        ECHO                                                     $0
  16     2      > RETURN                                                   null

End of function test2

End of class Test2.

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

Generated using Vulcan Logic Dumper, using php 7.3.0