Well, you can create a custom create option and use static variables to store an instance of each class created
Class Pet { public static $pets = array(); public static create($name, $type, $age) { $pet = new Pet($name, $type, $age); self::$pets[] = $pet; return $pet; } } Pet::createPet("test", "test", 42); Pet::createPet("test", "test", 42); Pet::createPet("test", "test", 42); foreach(Pet::$pets as $pet) { echo $pet->name; }
Tyler carter
source share