HI i want to sort an array of objects , it is in the form of array which has objects and each objects has key,value , i want to sort the objects based on value, the problem is the values contains the numbers which have spaces in between, and some are empty numbers too, so I am not able to sort it using usort any help would be appreciated.
here's a code snippet
array(4) {
[0]=>
object(stdClass)#308 (2) {
["key"]=>
string(2) "AF"
["value"]=>
string(3) "093"
}
[1]=>
object(stdClass)#306 (2) {
["key"]=>
string(2) "AL"
["value"]=>
string(3) "355"
}
[2]=>
object(stdClass)#304 (2) {
["key"]=>
string(2) "DZ"
["value"]=>
string(3) "213"
}
[3]=>
object(stdClass)#302 (2) {
["key"]=>
string(2) "AS"
["value"]=>
string(5) "1 684"
}
}
I want the result to be sorted based on the value.