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 t
You can use
usort($list, function ($a, $b) { $a = filter_var($a->value,FILTER_SANITIZE_NUMBER_INT); $b = filter_var($b->value,FILTER_SANITIZE_NUMBER_INT); return ($a == $b) ? 0 : (($a < $b) ? -1 : 1); });