I have array like this:
$items = array(
[1] => array(
['Name'] =>"Item 1",
['Prices'] => array(
['Base price'] => 80.25,
['Discount'] => 5.50
)
),
[2] => array(
['Name'] =>"Item 2",
['Prices'] => array(
['Base price'] => 70.25,
['Discount'] => 4.50
)
)
);
How can I sort $items that by "Base price"? I want to have lowest price in first element, highest in last element of output array with same structure.
Expected output:
$items = array(
[1] => array(
['Name'] =>"Item 2",
['Prices'] => array(
['Base price'] => 70.25,
['Discount'] => 4.50
)
),
[2] => array(
['Name'] =>"Item 1",
['Prices'] => array(
['Base price'] => 80.25,
['Discount'] => 5.50
)
)
);
I don't understand array_multisort() and how to use it in my case.
usort