Q:

usort won't work after merging to objects

I have the following code:
$content->Vehicles = (object)array_merge((array)$content->List, (array)$content_new->List);

The $content->List and $content_new->List are created from two API calls and is all working as expected.
The problem is I need to sort the object. To do so I use:
usort($content->Vehicles, function($a, $b) {
    return ($a->Score < $b->Score) ? -1 : (($a->Score > $b->Score) ? 1 : 0);
});

When I pass in $content->List it works as expected however $content->Vehicles results in usort() expects parameter 1 to be array, object given.
Would love to figure this one out.

A:

Well I fell silly now. Answer as follows:
$content->Vehicles = array_merge((array)$content->List, (array)$content_new->List);

