I have an array like this:
$myarray = array (
array(
array('Restaurant' =>
array(
'name' => 'Rodeo Ranch',
'distance' => 1.2
),
),
array('Menu' =>
array(
'title' => 'Steak with fries'
)
)
),
array(
array('Restaurant' =>
array(
'name' => 'City Bar',
'distance' => 0.9
),
),
array('Menu' =>
array(
'title' => 'Burger with Chicken'
),
array(
'title' => 'Hot-Dog'
)
)
)
);
Now, I want to sort the array, that the nearest Restaurant is on top. I tried this:
$myarray = array_msort($myarray['Restaurant'], array('distance'=>SORT_ASC));
This does not work. Any help?
Unfortunately, I should not change the array because for further handling it needs to be in this structure.
Thank you for any hints and tips.