I've been trying to find an example or tip on how to do this, and I'm at a loss finding a solution to this issue. I've got two questions - here's the following test code:

```
<?php
class TestClass {
    public $test;

    function __contruct(){

        // this fails:
        //$this->test = (object) array();

        // so does this:
        /*
        $this->test = new stdClass();
        $this->test->hello = function(){
            return 'hello world!';
        };
        */

        $this->test = array();
        $this->test['foo'] = 'bar';
        $this->test['buttons'] = array();
        $this->test['hello'] = function(){
            return 'hello world!';
        };
        $this->test['addButton'] = function($title,$url){
            // how do I call the class' addButton function and
            // pass a reference of the $test varaible so it gets updated?
        };

    }

    // this function would be used for multiple objects
    function addButton(&$obj,$title,$url){
        $obj['buttons'][] = array(
            'title' => $title,
            'url' => $url
        );
    }
}

$myTestClass = new TestClass;
// this results in:
// Fatal error: Call to a member function hello() on null
echo $myTestClass->test->hello();
?>

```

I'd appreciate any feedback you can give on