I have an array composed of arrays. I want to sort the parent array by a property of the child arrays. Here’s an example
array(2){
[0]=> array(3){
[0]=> string(6) "105945"
[1]=> string(10) "First name"
[2]=> float(0.080878465391)
}
[1]=> array(3) {
[0]=> string(6) "109145"
[1]=> string(11) "Second name"
[2]=> float(0.0504154818384)
}
}
I would like to sort the parent array by [2] ascending in the child arrays, so in this case the result would be the child arrays reversed (.05, 08). Is this possible using any of the numerous PHP sort functions?
You can make use of usort function as: