rendered paste bodyclass Test {
public $x = array();
//public $test;
function __get($i)
{
if(isset($this->{$i})) {
return($this->{$i});
}
elseif(isset($this->x[$i])) {
pre('------GET------'.$i);
pre($this->x[$i]);
return($this->x[$i]);
}
else {
return(NULL);
}
}
function __set($i, $val)
{
pre('--------SET---------');
if(isset($this->{$i})) {
$this->{$i} = $val;
}
else {
$this->x[$i] = $val;
}
}
}
$t = new Test();
$x = 5;
while($x>0) {
if(!is_array($t->test)) {
$t->test = array();
}
$t->test[3] = $x;
//array_push($t->test, $x);
$x--;
}
var_dump($t->test);