I have the following array of objects. I need to somehow sort these so that it returns the array with Partials then Successes then Decline while still keeping the grouping on start the same. So I would need to somehow sort each array by day and then do the custom sort by title so that it can show Partials then Success then Declines. Is this possible?
[0] => stdClass Object
(
[start] => 2020-09-29T00:00:00-04:00
[allDay] => 1
[title] => Successes
[test] => 3 Successes
)
[1] => stdClass Object
(
[start] => 2020-09-29T00:00:00-04:00
[allDay] => 1
[title] => Partials
[test] => 6 Partials
)
[2] => stdClass Object
(
[start] => 2020-09-29T00:00:00-04:00
[allDay] => 1
[title] => Declines
[test] => 10 Declines
)
[3] => stdClass Object
(
[start] => 2020-10-01T00:00:00-04:00
[allDay] => 1
[title] => Successes
[test] => 0 Successes
)
[4] => stdClass Object
(
[start] => 2020-10-01T00:00:00-04:00
[allDay] => 1
[title] => Partials
[test] => 0 Partials
)
[5] => stdClass Object
(
[start] => 2020-10-01T00:00:00-04:00
[allDay] => 1
[title] => Declines
[test] => 4 Declines
)
I have tried using a usort on the title, but then that breaks the start date sort already in place. I need to somehow sort the titles in the order described above while still keeping the arrays grouped by the same start value.
Keep in mind these are arrays of objects, and that a traditional sort wont yield the results in proper order Partial Success Declined. So a more custom solution is required.