<?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);
You have javascript disabled. You will not be able to edit any code.