This question already has an answer here:
I need to create an array from XML response and then order by one of the existing XML field.
I have parsed the XML fine and ended up with 3 values that I need in my foreach loop.
$optionsArray = array();
foreach ($options as $key => $option) {
$price = $option->Price;
$shortDesc = $option->ShortDescription;
$longDesc = $option->LongDescription;
$optionsArray[] = array('shortdesc' => $shortDesc, 'longdesc' => $longDesc, 'price' => $price);
}
This works fine, but now I wish to order the array using the 'price' value (descending) and then I can show the items correctly.
I have looked into usort and arsort and all the others but cannot make sense. Any examples using my code for help?
Thanks.
</div>