Ok, weird question. If I'm going about this all wrong somebody please tell me :s
I'm reading in information from a bunch of xml documents, and storing 4 pieces of information (name, id, price, description) from each in an associative array ($item['name'], $item['id'] etc.). I then added each $item to another array, $items. I want to be able to sort these records by either name or price, so I wrote a quicksort function, but I've hit a snag.
How would I go about switching the order of two items in an associative array in php? Is that even possible? How would I sort the xml data from multiple xml files, otherwise?
if the item id is the key, use ksort.. you can use array_map to filter the elements through a callback function. it's difficult to understand exactly what it is you're tryinig to accomplish without knowing more.. hopefully this helps a little.