Hi everyone,
How is parenting functions in PHP done properly according to the following example? Can I make sure that my array isn't overwritten and the previous values inside array lost, on each addArray call?
function arraybase() {
$this->array = new ArrayObject();
return $this;
}
function addArray($value) {
parent::$this->arraybase();
$this->array->append($value);
return $this;
}
$this->addArray('1')->addArray('2')->addArray('3');
// outputs:
Array
(
[0] => 3
)
Thanks a lot!