- var_dump: documentation ( source)
<?php
class T
{
public function __get($property)
{
if (!isset($this->{$property}))
{
$this->{$property} = array();
}
return $this->{$property};
}
public function __set($key, $val)
{
$this->{$key} = $val;
}
}
$testObj = new T();
$testObj->testArr;
$testObj->testArr[] = 1;
$testObj->testArr[] = 2;
$testObj->testArr[] = 3;
var_dump($testObj->testArr);