- var_dump: documentation ( source)
<?php
class x
{
protected $_data = [];
function __set($k, $v)
{
$this->$k = new y($v);
}
}
class y
{
protected $name;
public function __construct($n)
{
$this->name = $n;
}
}
$x = new x;
$x->a = 'a';
$x->a = 'b';
var_dump($x);