Is it possible to organize such a structure in PHP, and if so, how.
Given 3 classes A, B and C.
class A { public $error = array(); public function errors() { foreach ($this->error as $err) { echo $err."<br>"; } } } class B extends class A { public function __construct { $this->error[] = "Ошибка 1"; } } class C extends class A { public function __construct { $this->error[] = "Ошибка 2"; } } $a = new A(); $b = new B(); $c = new C(); $a->errors(); How to do this (what needs to be changed in the code) so that the result of this script becomes:
Ошибка 1 Ошибка 2