3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait MyTrait { private $abc = 1; public function increment() { $this->abc++; } public function getValue() { return $this->abc; } } class MyClass { use MyTrait; public function incrementBy2() { $this->increment(); $this->abc++; } } $c = new MyClass; $c->incrementBy2(); var_dump($c->getValue());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dXIep
function name:  (null)
number of ops:  12
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_CLASS                                            'myclass'
   20     1        NEW                                              $1      'MyClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   21     4        INIT_METHOD_CALL                                         !0, 'incrementBy2'
          5        DO_FCALL                                      0          
   22     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !0, 'getValue'
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class MyTrait:
Function increment:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dXIep
function name:  increment
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   PRE_INC_OBJ                                              'abc'
    6     1      > RETURN                                                   null

End of function increment

Function getvalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dXIep
function name:  getValue
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                      ~0      'abc'
          1      > RETURN                                                   ~0
    9     2*     > RETURN                                                   null

End of function getvalue

End of class MyTrait.

Class MyClass:
Function incrementby2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dXIep
function name:  incrementBy2
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_METHOD_CALL                                         'increment'
          1        DO_FCALL                                      0          
   17     2        PRE_INC_OBJ                                              'abc'
   18     3      > RETURN                                                   null

End of function incrementby2

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.92 ms | 1396 KiB | 15 Q