Jump to content


Sorting a multidimensional array

  • Please log in to reply
1 reply to this topic

#1 azuka

  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts
  • LocationNigeria

Posted 26 March 2006 - 12:38 AM

I have an array whose member consist of arrays. I have a problem sorting them. The problem is that for each index, the array structure may vary but it either has these keys [BookId,BookName,BookSummary,Sort] or [ChapId,ChapName,ChapText,BookId, Sort]. Since Sort is common to both arrays, I want to sort by Sort in descending order. How possible is that?
Given enough eyeballs all bugs are shallow. My Website

#2 ToonMariner

  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 26 March 2006 - 03:29 AM

Split them up into arrays of similar types (don't mix books nad chapters0 and then look at using array_mulit sort.
follow me on twitter @PHPsycho

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users