3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait A { public $foo; function foo() { assert($this->foo === NULL); $this->foo = TRUE; } } trait B { public $foo; function bar() { assert($this->foo === NULL); $this->foo = TRUE; } } class C { use A, B; } $c = new C; $c->foo(); $c->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q8vOJ
function name:  (null)
number of ops:  9
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'c'
   15     1        NEW                                              $1      'C'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   16     4        INIT_METHOD_CALL                                         !0, 'foo'
          5        DO_FCALL                                      0          
   17     6        INIT_METHOD_CALL                                         !0, 'bar'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q8vOJ
function name:  foo
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSERT_CHECK                                             
          1        INIT_FCALL                                               'assert'
          2        FETCH_OBJ_R                                      ~0      'foo'
          3        TYPE_CHECK                                    2  ~1      ~0
          4        SEND_VAL                                                 ~1
          5        SEND_VAL                                                 'assert%28%24this-%3Efoo+%3D%3D%3D+NULL%29'
          6        DO_ICALL                                                 
          7        ASSIGN_OBJ                                               'foo'
          8        OP_DATA                                                  <true>
          9      > RETURN                                                   null

End of function foo

End of class A.

Class B:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q8vOJ
function name:  bar
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSERT_CHECK                                             
          1        INIT_FCALL                                               'assert'
          2        FETCH_OBJ_R                                      ~0      'foo'
          3        TYPE_CHECK                                    2  ~1      ~0
          4        SEND_VAL                                                 ~1
          5        SEND_VAL                                                 'assert%28%24this-%3Efoo+%3D%3D%3D+NULL%29'
          6        DO_ICALL                                                 
          7        ASSIGN_OBJ                                               'foo'
          8        OP_DATA                                                  <true>
          9      > RETURN                                                   null

End of function bar

End of class B.

Class C: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.4 ms | 1011 KiB | 14 Q