3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ "route_id" => 1539871200, "booking_id" => 171, "route" => "Boattrip Destination 2", "date" => "18 October 2018", "time" => "14:00 - 16:00" ], [ "route_id" => 1539856800, "booking_id" => 170, "route" => "Boattrip Destination 2", "date" => "18 October 2018", "time" => "10:00 - 12:00" ], [ "route_id" => 1539856800, "booking_id" => 162, "route" => "Boattrip Destination 2", "date" => "18 October 2018", "time" => "10:00 - 12:00" ] ]; foreach ($array as $set) { if (isset($result[$set["route_id"]])) { $result[$set["route_id"]]["booking_ids"][] = $set["booking_id"]; } else { $result[$set["route_id"]] = [ "route" => $set["route_id"], "date" => $set["date"], "time" => $set["time"], "booking_ids" => [$set["booking_id"]] ]; } } ksort($result); // ... you did say you wanted to sort them by route_id var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 1539856800 => array ( 'route' => 1539856800, 'date' => '18 October 2018', 'time' => '10:00 - 12:00', 'booking_ids' => array ( 0 => 170, 1 => 162, ), ), 1539871200 => array ( 'route' => 1539871200, 'date' => '18 October 2018', 'time' => '14:00 - 16:00', 'booking_ids' => array ( 0 => 171, ), ), )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
54.51 ms | 402 KiB | 8 Q