I have a class Team{}. I have an array of strings $teams = array('team1', 'team2', 'team3'). I want to loop through the array and create an object with each string as the object name.
class Team{}
$teams = array('team1', 'team2', 'team3');
foreach ($teams as $team) {
$team = new Team();
}
So $team1, $team2 and $team3 becomes object.
Thanks for your help.