- var_export: documentation ( source)
- usort: documentation ( source)
<?php
$array = [
(object) ['ID' => 1, 'name' => 'Mary Jane', 'count' => '420'],
(object) ['ID' => 2, 'name' => 'Johnny', 'count' => '23420'],
(object) ['ID' => 3, 'name' => 'Kathy', 'count' => '4354'],
];
$property = 'count';
usort($array, fn($a,$b) => $a->$property <=> $b->$property);
var_export($array);