Is there a simple way to order this array (the days will always be displayed in right order)
0 => "Thursday,Sunday"
1 => "Tuesday"
2 => "Monday"
3 => "Tuesday,Thursday,Saturday"
4 => "Tuesday"
5 => "Monday,Wednesday"
6 => "Saturday,Sunday"
8 => "Wednesday"
9 => "Saturday"
10 => "Tuesday"
11 => "Monday,Sunday"
in this ordery (by days of the week)
2 => "Monday"
5 => "Monday,Wednesday"
11 => "Monday,Sunday"
1 => "Tuesday"
4 => "Tuesday"
10 => "Tuesday"
3 => "Tuesday,Thursday,Saturday"
7 => "Tuesday,Friday"
8 => "Wednesday"
0 => "Thursday,Sunday"
9 => "Saturday"
6 => "Saturday,Sunday"
In the end I'll need to define the starting day but hopefully it should be easy to generalize the solution.
Thanks!
UPDATE
Next question is how do I rearrange the
$day_map = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
to start from today date('l')
. So if today's Fridey I would get
$rearranged_day_map = ['Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday'];
And the answer to the updated question (the answer to the original question is below):
//days
$day_map = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
//order days to start from tomorrow
$today = date('N'); // get today's day of the week
$day_map_rearranged = array_merge(array_slice($day_map, $today),array_slice($day_map, 0, $today));