public function add_buildings() { for ($i = 0; $i < $this->buildcount; $i++) { $building = new Building($i + 1, rand(1, 16), rand(1, 6), rand(4, 6), rand(1000, 2000)); $building->addflats(); $this->arr_of_buildings[] = $building; //$building->display(); } }