I have arrays with the following names: $MyMondayClasses, $MyTuesdayClasses, $MyWednesdayClasses, $MyThursdayClasses, $MyFridayClasses
And I have an array for days of the week: $days = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday');
I want to loop through the days of the week and then run the appropriate array, but I'm not sure how to refer to the variable to make:
foreach($days as $value){
foreach($My{$value}Classes as $ClassKey => $ClassVar){
some code goes here
}
}
I used to use eval for this sort of thing, but understand that's not best practice. Anyway, the above code isn't working.
$MyDAYClasses
arrays in another array with the days for indices from the beginning ? e.g.classes = array('Monday'=> $MyMondayClasses), ...);
That way when you want to look them up, you can find them easily. – dnagirl Mar 20 at 16:29