PHP: Sub class static inheritance - children share static variables?
As you can see below I have a super class (Article) and two sub classes. I want each of the sub classes to have a static array that shall hold all it's objects. abstract class Article { public static $articles = array(); // Variable for storing all the objects of each sub-class. public function add_Object_To_Array() { array_push(self::$articles, $this); } } class Report extends Article{} class Interview extends Article{} -Making two Report objects and adding them to their array: $tmp = new Report(); $tmp->add_Object_To_Array(); $tmp = new Report(); $tmp->add_Object_To_Array(); -Making two