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 );

preferences:
32.34 ms | 402 KiB | 5 Q