So I have this result from database:
object(Illuminate\Support\Collection)#538 (1) {
["items":protected]=>
array(3) {
[0]=>
object(stdClass)#536 (3) {
["col_header"]=>
string(7) "other_1"
["col_order"]=>
int(12)
["data"]=>
string(13) "asdgasdgfasdg"
}
[1]=>
object(stdClass)#545 (3) {
["col_header"]=>
string(7) "other_2"
["col_order"]=>
int(10)
["data"]=>
string(10) "dfhgsdhgsd"
}
[2]=>
object(stdClass)#533 (3) {
["col_header"]=>
string(7) "other_3"
["col_order"]=>
int(11)
["data"]=>
string(1) "s"
}
}
Now, how can I sort its result based on value of col_order?The result should be like:
object(Illuminate\Support\Collection)#538 (1) {
["items":protected]=>
array(3) {
[0]=>
object(stdClass)#545 (3) {
["col_header"]=>
string(7) "other_2"
["col_order"]=>
int(10)
["data"]=>
string(10) "dfhgsdhgsd"
}
[1]=>
object(stdClass)#533 (3) {
["col_header"]=>
string(7) "other_3"
["col_order"]=>
int(11)
["data"]=>
string(1) "s"
}
[2]=>
object(stdClass)#536 (3) {
["col_header"]=>
string(7) "other_1"
["col_order"]=>
int(12)
["data"]=>
string(13) "asdgasdgfasdg"
}
}
I've tried using asort() here but it seems it only supports associative array. Is there any way I can sort this one out?