0

I have an array with lots of elements like this:

$items[] = array($url, $pic, $price);

I need $items to be sorted after $price ascending. Is there a good function to do this?

Kristian Rafteseth
  • 2,002
  • 5
  • 27
  • 46

1 Answers1

1
  function cmp($a, $b)
  {
     return $b[2] - $a[2];
  }

     usort($item, "cmp")
aseferov
  • 6,155
  • 3
  • 17
  • 24