I would like to pass one variable into an array. I have two classes. One MenuClass is used to register menus - and I need the variable populated as an array. I will be using the second class extended, and passing in multiple menus. So I need each run to insert another item into the Main->loaded_menus[] array.
They are loaded in different files, but loaded at the same time. Here is a very basic example of what I am working with...
class Main {
public $loaded_Menus = array();
public function __construct() {}
}
class MenuClass {
public $name;
public $id;
public function build($id, $name) {
$this->id = $id;
$this-name = $name;
$populate = new Main;
$populate->loaded_Menus[$this->id] = $this->id;
}
}