I want to make an array sort method so you can sort some info via price/ID number etc.
My array is like this:
[1] 1002234985, $123.00, ITEM DESCRIPTION #1
[2] 1034234985, $143.70, ITEM DESCRIPTION #2
[3] 1002467455, $133.06, ITEM DESCRIPTION #3
[4] 1564334985, $883.11, ITEM DESCRIPTION #4
I want to sort the array by price, but have the descriptions and ID numbers match up. How can I do this?
Thanks!
write the
comparefunction (that receives two elements and returns which one is bigger) and use usort to use itAn example: