Is there a way to identify and loop all objects created from a class? I've inserted a small code below, and I would like those objects listed in a loop of some kind. The purpose is for me to organize my instanced objects, and to identify which class they belong.
been searching it and found no answers whatsoever.
For example
<?php
class defender{
public $name;
public $hp;
public $attack;
public $defense;
function stats(){
$this->name;
}
function search(){
}
}
$wyvern1 = new defender();
$wyvern1->name = "White Blade1";
$wyvern1->id = "w-123";
$wyvern2 = new defender();
$wyvern2->name = "White Blade2";
$wyvern2->id = "w-124";
$wyvern3 = new defender();
$wyvern3->name = "White Blade3";
$wyvern3->id = "w-125";
?>