3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Bar { function __destruct() { print_r($this->things); } protected function addThing($n, $v) { $this->things[$n] = $v; } } class Foo { protected $things = [ '1' => 'one' ]; use Bar; public function __construct() { $this->addThing('2', 'two'); } } new Foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RoQfh
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   DECLARE_CLASS                                            'foo'
   27     1        NEW                                              $0      'Foo'
          2        DO_FCALL                                      0          
          3        FREE                                                     $0
          4      > RETURN                                                   1

Class Bar:
Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RoQfh
function name:  __destruct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'print_r'
          1        FETCH_OBJ_R                                      ~0      'things'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    7     4      > RETURN                                                   null

End of function __destruct

Function addthing:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RoQfh
function name:  addThing
number of ops:  6
compiled vars:  !0 = $n, !1 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        FETCH_OBJ_W                                      $2      'things'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   11     5      > RETURN                                                   null

End of function addthing

End of class Bar.

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RoQfh
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_METHOD_CALL                                         'addThing'
          1        SEND_VAL_EX                                              '2'
          2        SEND_VAL_EX                                              'two'
          3        DO_FCALL                                      0          
   24     4      > RETURN                                                   null

End of function __construct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.86 ms | 1396 KiB | 15 Q