<?php
$objects = [
(object)['Leasing' => 12939.74, 'Name' => 'Jeremy', 'Rental' => 0, 'Sales' => 56603.13, 'Total' => 69542.87],
(object)['Leasing' => 0, 'Name' => 'Shaun', 'Rental' => 0, 'Sales' => 58590, 'Total' => 58590],
(object)['Leasing' => 0, 'Name' => 'Lindsay', 'Rental' => 0, 'Sales' => 22951.97, 'Total' => 22951.97],
(object)['Leasing' => 0, 'Name' => 'Sally', 'Rental' => 1200, 'Sales' => 21624.9, 'Total' => 22824.9],
(object)['Leasing' => 0, 'Name' => 'House', 'Rental' => 0, 'Sales' => 16235.81, 'Total' => 16235.81],
(object)['Leasing' => 5298.85, 'Name' => 'Bill', 'Rental' => 1200, 'Sales' => 0, 'Total' => 6498.85]
];
usort($objects, function($a, $b) {
return [$b->Name === 'House', $b->Total] <=> [$a->Name === 'House', $a->Total];
});
var_export($objects);
preferences:
26.19 ms | 405 KiB | 5 Q