Possible Duplicate:
How do I sort a multidimensional array in php
Sorting an associative array in PHP
I have an array of hours, titles and descriptions, but the hours are disordered (12:00, 04:15, 18:30, 10:20...)
This is my PHP code:
$content = simplexml_load_file( $sampleXML );
foreach( $content->item as $item ) {
echo $item->hour;
echo $item->title;
echo $item->description;
}
and this is a sample of the XML:
<item>
<hour>12:00</hour>
<title>Sample Title 1</title>
<description>Sample Description 1</description>
</item>
<item>
<hour>04:15</hour>
<title>Sample Title 1</title>
<description>Sample Description 1</description>
</item>
<item>
<hour>18:30</hour>
<title>Sample Title 1</title>
<description>Sample Description 1</description>
</item>
I need to sort the hours with it's corresponding title and description. How can I do this?