3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DataCollector { protected $dataObj; public function __construct() { $this->dataObj = new stdClass(); } public function __set( $name, $value ) { $this->dataObj->name = $value; } } $test = new stdClass(); $test->cake = 'hi'; $DataCollector = new DataCollector(); $DataCollector->node = $test; $DataCollector->node->cake = 'bye'; var_dump( $DataCollector );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f2m5p
function name:  (null)
number of ops:  17
compiled vars:  !0 = $test, !1 = $DataCollector
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $2      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   13     3        ASSIGN_OBJ                                               !0, 'cake'
          4        OP_DATA                                                  'hi'
   15     5        NEW                                              $6      'DataCollector'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $6
   16     8        ASSIGN_OBJ                                               !1, 'node'
          9        OP_DATA                                                  !0
   17    10        FETCH_OBJ_W                                      $10     !1, 'node'
         11        ASSIGN_OBJ                                               $10, 'cake'
         12        OP_DATA                                                  'bye'
   19    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class DataCollector:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f2m5p
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $1      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'dataObj'
          3        OP_DATA                                                  $1
          4      > RETURN                                                   null

End of function __construct

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

End of function __set

End of class DataCollector.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.37 ms | 1388 KiB | 15 Q