Here is a simplified version of the array. It is easy to sort this by 'id', or 'created_by', but I'm having a hard time figuring out how to sort it by the value of "e5e53240-1d5a-4b50-ad7d-cfa00f33badd" inside the 'elements' object. I've spent hours searching through other questions trying to figure this out, but with no luck.
So here's the simplified version of the array via print_r:
[0] => stdClass Object
(
[id] => 12
[created_by] => 776
[searchable] => 1
[elements] => {
"b2c4ecaa-f68f-4a5c-a551-339aa8f01421": {
},
"e5e53240-1d5a-4b50-ad7d-cfa00f33badd": {
"0": {
"value": "Aeronca"
}
},
"d7c903a8-fa15-4620-9d9b-2238cb48fd5c": {
"0": {
"value": "L-3B"
}
}
)
[1] => stdClass Object
(
[id] => 21
[created_by] => 776
[searchable] => 1
[elements] => {
"b2c4ecaa-f68f-4a5c-a551-339aa8f01421": {
},
"e5e53240-1d5a-4b50-ad7d-cfa00f33badd": {
"0": {
"value": "BEECHCRAFT"
}
},
"d7c903a8-fa15-4620-9d9b-2238cb48fd5c": {
"0": {
"value": "N-35"
}
}
)
[2] => stdClass Object
(
[id] => 13
[created_by] => 776
[searchable] => 1
[elements] => {
"b2c4ecaa-f68f-4a5c-a551-339aa8f01421": {
},
"e5e53240-1d5a-4b50-ad7d-cfa00f33badd": {
"0": {
"value": "AEROSPORT"
}
},
"d7c903a8-fa15-4620-9d9b-2238cb48fd5c": {
"0": {
"value": ""
}
}
)
So basically the array, when sorted, should have the first element be where it is now, followed by the third element, followed by the second, so it would look like this:
[0] => stdClass Object
(
[id] => 12
[created_by] => 776
[searchable] => 1
[elements] => {
"b2c4ecaa-f68f-4a5c-a551-339aa8f01421": {
},
"e5e53240-1d5a-4b50-ad7d-cfa00f33badd": {
"0": {
"value": "Aeronca"
}
},
"d7c903a8-fa15-4620-9d9b-2238cb48fd5c": {
"0": {
"value": "L-3B"
}
}
)
[1] => stdClass Object
(
[id] => 13
[created_by] => 776
[searchable] => 1
[elements] => {
"b2c4ecaa-f68f-4a5c-a551-339aa8f01421": {
},
"e5e53240-1d5a-4b50-ad7d-cfa00f33badd": {
"0": {
"value": "AEROSPORT"
}
},
"d7c903a8-fa15-4620-9d9b-2238cb48fd5c": {
"0": {
"value": ""
}
}
)
[2] => stdClass Object
(
[id] => 21
[created_by] => 776
[searchable] => 1
[elements] => {
"b2c4ecaa-f68f-4a5c-a551-339aa8f01421": {
},
"e5e53240-1d5a-4b50-ad7d-cfa00f33badd": {
"0": {
"value": "BEECHCRAFT"
}
},
"d7c903a8-fa15-4620-9d9b-2238cb48fd5c": {
"0": {
"value": "N-35"
}
}
)
Keep in mind that the actual array is far more complex, and contains close to 1,000 elements in the array, so hopefully whatever method I use would minimize load on the server.