I have an array like this:
$flight = array (
array (
"home" => "AMS",
"away" => "LHR",
"price" => "270"
),
array (
"home" => "AMS",
"away" => "LGW",
"price" => "216"
),
array (
"home" => "EIN",
"away" => "LHR",
"price" => "427"
)
);
I want the values from the cheapest flight. The result should be: AMS LGW 216.
When I loop trough the array I can get the lowest price result but not the other values from the array home and away.
foreach ($flight as $value) {
echo $value["home"].' '.$value["away"].' '.$value["price"].'<br>';
$lowest = array_column($flight, "price");
$min = min($lowest);
}
echo $min;
The result now is only 216 But the result I want AMS LGW 216
How can I create this?