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
  • 1,982
  • 4
  • 25
  • 42

1 Answers1

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

     usort($item, "cmp")
aseferov
  • 5,615
  • 3
  • 14
  • 20