How do I extend my parent's options array for child classes in PHP?
I have something like this:
class ParentClass {
public $options = array(
'option1'=>'setting1'
);
//The rest of the functions would follow
}
I would like to append to that options array in a child class without erasing any of the parent options. I've tried doing something like this, but haven't quite got it to work yet:
class ChildClass extends ParentClass {
public $options = parent::options + array(
'option2'=>'setting2'
);
//The rest of the functions would follow
}
What would be the best way to do something like this?