I want to create a <select>
field from all Gender objects. Is there a way to iterate over all the objects created from the class of Gender?
class Gender {
public static $counter = 0;
public $id;
public $gender;
public function __construct($gender){
Gender::$counter++;
$this->id = Gender::$counter;
$this->gender = $gender;
}
}
// Objects
$gender_male = new Gender('Male');
$gender_female = new Gender('Female');