Okay, I have an array that is used to transport names, it looks like this:
array(2) {
[0]=>
array(3) {
["firstName"]=>
string(3) "Joe"
["lastName"]=>
string(5) "Black"
["uid"]=>
int(3225)
}
[1]=>
array(3) {
["firstName"]=>
string(4) "John"
["lastName"]=>
string(3) "Doe"
["uid"]=>
int(3516)
}
}
Now, how do I sort this array by lastName?
StackOverflow has lots of similar questions, but let me give you a quick example. For this, you can use the
usort()function.PHP 5.3 example (not the nicest one, but might be easier to understand):