I am new to PHP OOP and I am having problem getting arrays back.
class example
{
public $array;
public function __construct()
{
$this->array = array();
}
public function do_work()
{
$this->array[] = 'test';
}
}
$test = new example();
$test->do_work();
$test->array;
I keep getting a empty array instead of 'test'. What am I doing wrong?