Hi thinking i have an array like this :
[0]=>[
[0]=>'Hey',
[1]=>'H',
[2]=>'He',
]
now i would like to sort by number chars and return somenthing like this:
[0]=>[
[0]=>'H',
[1]=>'He',
[2]=>'Hey',
]
maybe the answer is array_sort() but i'm not able to do that. also i would not like to loop the array to check the number chars of values, but if it's the only way i need to use anyway :P
BTW
how to return this same array ordered by ['name'] key number of chars ASC (h - he -hey -heyh - heyhey )?
array(5) {
[0]=>
array(2) {
["id"]=>
object(MongoId)#26 (1) {
["$id"]=>
string(24) "4e72858ccaa47ca608030000"
}
["name"]=>
string(4) "h"
}
[1]=>
array(2) {
["id"]=>
object(MongoId)#29 (1) {
["$id"]=>
string(24) "4e72858ccaa47ca608040000"
}
["name"]=>
string(10) "hey"
}
[2]=>
array(2) {
["id"]=>
object(MongoId)#31 (1) {
["$id"]=>
string(24) "4e72858ccaa47ca608400000"
}
["name"]=>
string(1) "heyhey"
}
[3]=>
array(2) {
["id"]=>
object(MongoId)#33 (1) {
["$id"]=>
string(24) "4e72858ccaa47ca6081a0000"
}
["name"]=>
string(6) "he"
}
[4]=>
array(2) {
["id"]=>
object(MongoId)#35 (1) {
["$id"]=>
string(24) "4e72858ccaa47ca6083d0000"
}
["name"]=>
string(3) "heyh"
}
}