The $list
parameter in the OrderListById
must be a reference:
public function OrderListById(array &$list)
{
usort($list, function($a, $b) {
return $a['id'] - $b['id'];
});
}
Should work.
As a precaution you could typecast values as you compare them, just in case they are not integers, however, that's something you should check before you sort the array:
return (int) $a['id'] - (int) $b['id'];