Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/12/2023 in all areas

  1. try using a custom sort function # # Sort attendees on course, name # usort($attendees, function($a, $b) { $x = $a['course']<=>$b['course']; if ($x == 0) return $a['name']<=>$b['name']; return $x; }); # # Add sorted attendees to result array # $result = array(); foreach ($attendees as $attendee): $result[$attendee['course']][] = $attendee; endforeach; # # View result # echo '<pre>' . print_r($result, 1) . '</pre>'; P.S. You didn't say in what order you want them. If your aim is merely to get the courses in order then you could use ksort($result) (instead of your current sort() )to order the keys.
    1 point
This leaderboard is set to New York/GMT-05:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.