Sorting and outputting a multi-dimensional array

Angelllus

New Member
I have a multi-dimensional array right now that looks like this:\[code\]function art_appreciation_feeds() { $items = array( array('site' => '', 'uri' => '', 'feed' => ''), array('site' => '', 'uri' => '', 'feed' => ''), array('site' => '', 'uri' => '', 'feed' => ''), array('site' => '', 'uri' => '', 'feed' => ''), ); return $items; }\[/code\]Right, so I output the values of the array using this function:\[code\]foreach($items as $i => $row) {\[/code\]What I'm looking to do, is add another value to that array called \[code\]category\[/code\] so that I'd have:\[code\]array( array('site' => '', 'uri' => '', 'feed' => '', 'category' => ''),);\[/code\]And when I'm going through the loop above, to output it in order by the \[code\]category\[/code\] field with a \[code\]<h2>Category</h2>\[/code\] at the top only of each section.Is that the best way to do this and if so, how would I change my loop to accommodate that? Caveat: I can change the array as well if you think something else is better.Thanks!
 
Back
Top