3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait trt { protected $prop; } class inst { use trt; public function set($x) { $this->prop = $x; } public function get() { return $this->prop; } } $a = new inst(); $b = new inst(); $a->set("foo"); $b->set("bar"); echo $a->get(); echo "\n"; echo $b->get();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S3hEc
function name:  (null)
number of ops:  21
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_CLASS                                            'inst'
   16     1        NEW                                              $2      'inst'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   17     4        NEW                                              $5      'inst'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   18     7        INIT_METHOD_CALL                                         !0, 'set'
          8        SEND_VAL_EX                                              'foo'
          9        DO_FCALL                                      0          
   19    10        INIT_METHOD_CALL                                         !1, 'set'
         11        SEND_VAL_EX                                              'bar'
         12        DO_FCALL                                      0          
   20    13        INIT_METHOD_CALL                                         !0, 'get'
         14        DO_FCALL                                      0  $10     
         15        ECHO                                                     $10
   21    16        ECHO                                                     '%0A'
   22    17        INIT_METHOD_CALL                                         !1, 'get'
         18        DO_FCALL                                      0  $11     
         19        ECHO                                                     $11
         20      > RETURN                                                   1

Class trt: [no user functions]
Class inst:
Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S3hEc
function name:  set
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               'prop'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function set

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

End of function get

End of class inst.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.92 ms | 1395 KiB | 13 Q