I understand that this code is sorting up activity array the by latest start time and also just display which any activity that come first in the loop that have same date.
foreach ($activity_array AS $k => $v):
......
usort($v['activity'], function ($a, $b) {
$ad = new DateTime($a['start']);
$bd = new DateTime($b['start']);
if ($ad == $bd) {
return 0;
}
return $ad < $bd ? -1 : 1;
});
How can i sort it if the start time is the same, but got another venue variable that needed to be sort within the same activity.
| Activity | Start | Venue |
+------------+----------------+-----------+
| Activity A | 22/10/17 08.30 | Floor 1 |
| Activity D | 22/10/17 10.30 | Hall 3 |
| Activity B | 22/10/17 10.30 | Hall 1 |
| Activity C | 22/10/17 10.30 | Hall 2 |
| Activity X | 22/10/17 09.30 | Floor 2 |
to be like:
| Activity | Start | Venue |
+------------+----------------+-----------+
| Activity A | 22/10/17 08.30 | Floor 1 |
| Activity X | 22/10/17 09.30 | Floor 2 |
| Activity B | 22/10/17 10.30 | Hall 1 |
| Activity C | 22/10/17 10.30 | Hall 2 |
| Activity D | 22/10/17 10.30 | Hall 3 |