Lets say my array is this:
[
{
"uid": 85,
"priority": 3,
"events_count": 2
},
{
"uid": 83,
"priority": 1,
"events_count": 5
},
{
"uid": 50,
"priority": 2,
"events_count": 1
}
]
What i want to do is sort by "priority" Property of objects in a descending order. This part is accomplished and works with the code below.
usort($users, function($a, $b)
{
return strcmp($a->priority, $b->priority)*-1;
});
So far so good. Now i want to set an overwriting sort which puts all items with events_count > 4 at last position. This i am not sure even how to start. Preferably i would do both logic inside the usort. Is that possible and how would i do that?
Thanks