3v4l.org

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

Class MyTrait:
Function increment:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ptmU9
function name:  increment
number of ops:  5
compiled vars:  !0 = $by
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        FETCH_THIS                                       $1      
          2        ASSIGN_OBJ_OP                                 1          $1, 'abc'
          3        OP_DATA                                                  !0
    9     4      > 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/ptmU9
function name:  getValue
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~0      'abc'
          1      > RETURN                                                   ~0
   14     2*     > RETURN                                                   null

End of function getvalue

End of class MyTrait.

Class MyClass:
Function increment:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ptmU9
function name:  increment
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_STATIC_METHOD_CALL                                  'MyTrait', 'increment'
          1        SEND_VAL                                                 1
          2        DO_FCALL                                      0          
   24     3      > RETURN                                                   null

End of function increment

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.38 ms | 1396 KiB | 15 Q