3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait PropertyTrait { public $prop = 'default'; } class A { use PropertyTrait; } class B extends A { public $prop = 'overridden'; public function write() { echo $this->prop; } } $b = new B(); $b->write(); echo "\nB uses these traits: ", implode(',', class_uses(B::class)), "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9pAec
function name:  (null)
number of ops:  18
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'a'
   13     1        DECLARE_CLASS                                            'b', 'a'
   23     2        NEW                                              $1      'B'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   25     5        INIT_METHOD_CALL                                         !0, 'write'
          6        DO_FCALL                                      0          
   27     7        ECHO                                                     '%0AB+uses+these+traits%3A+'
          8        INIT_FCALL                                               'implode'
          9        SEND_VAL                                                 '%2C'
         10        INIT_FCALL                                               'class_uses'
         11        SEND_VAL                                                 'B'
         12        DO_ICALL                                         $5      
         13        SEND_VAR                                                 $5
         14        DO_ICALL                                         $6      
         15        ECHO                                                     $6
         16        ECHO                                                     '%0A'
         17      > RETURN                                                   1

Class PropertyTrait: [no user functions]
Class A: [no user functions]
Class B:
Function write:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9pAec
function name:  write
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      'prop'
          1        ECHO                                                     ~0
   20     2      > RETURN                                                   null

End of function write

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.77 ms | 1011 KiB | 15 Q