I have done a code in foreach :
foreach ($queries as $record) {
    $total[] = $record->TotalTrans;
}
and from this record I wanted to determine top 5 results integer.
Example of the results are :
stdClass Object
(
    [Transactions] => A
    [TotalTrans] => 2
)
stdClass Object
(
    [Transactions] => B
    [TotalTrans] => 95
)
stdClass Object
(
    [Transactions] => C
    [TotalTrans] => 5
)
stdClass Object
(
    [Transactions] => D
    [TotalTrans] => 12
)
stdClass Object
(
    [Transactions] => E
    [TotalTrans] => 4
)
is there a way to sort it in the foreach? thank you
 
     
    