Thread: Array Sorting
View Single Post
Old Jan 22nd, 2008, 7:23 PM   #1
grimpirate
King of Portal
 
grimpirate's Avatar
 
Join Date: Sep 2005
Posts: 431
Rep Power: 4 grimpirate is on a distinguished road
Send a message via Yahoo to grimpirate
Question Array Sorting

I know how to sort an array by comparing each of the values in the array and then sorting them according to less than, greater than or equal to each other. However, given the case where I had an array of arrays (an n-dimensional array). How would I sort? Take this example:
Quote:
array(
array(
'lastName' => 'ab', 'firstName' => 'cd'
),
array(
'lastName' => 'ef', 'firstName' => 'gh'
),
array()
....)
How would I sort it according to the lastName and then maintaining that order sort it according to the firstName? Can anybody point me to some references to this or tell me what this type of sorting is called? I'm not sure what to even type into Google.
__________________
Lo, there do I see my father. 'Lo, there do I see My mother, and my sisters, and my brothers. 'Lo, there do I see The line of my people... Back to the beginning. 'Lo, they do call to me. They bid me take my place among them. In the halls of Valhalla... Where the brave... May live... ...forever.. GrimBB | Mimesis
grimpirate is offline   Reply With Quote