I'm querying a MySQL database for reservations, like so
$query = "
SELECT *
FROM tbl_reservations r
LEFT
JOIN tbl_admins a
ON a.admin_id = r.reservation_driverID
WHERE reservation_time >= :pickup
AND reservation_endtime <= :endtime
AND reservation_status = 0
ORDER
BY reservation_time DESC
";
$getRes = $pdo->prepare($query);
$getRes->bindparam(":pickup", $pickup);
$getRes->bindparam(":endtime", $dropoff);
$getRes->execute();
$reservations = $getRes->fetchAll(PDO::FETCH_ASSOC);
This gives me back a nice list of reservations into one single array.
I'm wondering, using PHP, what would be the best way to loop though this array of objects and split it into multiple arrays, where each array would contain all of the trips for an individual driver (so, filtering by tbl_admins.admin_id)