Hi all,
I have an array that i need to order but I'm looking for some advice as how to do it. The array looks like this:
<?php
$myarray[0]['order'] = 39;
$myarray[0]['title'] = "title 1";
$myarray[1]['order'] = 39;
$myarray[1]['title'] = "title 2";
$myarray[2]['order'] = 5;
$myarray[2]['title'] = "title 3";
$myarray[3]['order'] = 0;
$myarray[3]['title'] = "title 4";
etc...
?>
I need to be able to order the array in ascending order based on the "order" element so it will look like this:
<?php
$myarray[0]['order'] = 0;
$myarray[0]['title'] = "title 4";
$myarray[1]['order'] = 5;
$myarray[1]['title'] = "title 3";
$myarray[2]['order'] = 39;
$myarray[2]['title'] = "title 1";
$myarray[3]['order'] = 39;
$myarray[3]['title'] = "title 2";
etc...
?>
Any ideas how i would achieve this? Normally it would be pretty easy: simply use the order as the index of the array, but the problem with that is that I would lose one because there are two 39's!
Any clues?!
Thanks