Sort an array of objects

Here is a quick php bit of code to sort an array of objects.

<?php
//sample array of objects
$aObjects = Array
  (
    [
0] => stdClass Object
       
(
            [
ID] => 1
           
[name] => Mary Jane
           
[count] => 420
       
)

    [1] => stdClass Object
       
(
            [
ID] => 2
           
[name] => Johnny
           
[count] => 234
       
)

    [2] => stdClass Object
       
(
            [
ID] => 3
           
[name] => Kathy
           
[count] => 4354
       
)
)
?>

This will sort that array by the name.

<?php
 usort
($aObjects , function($a, $b)
  {
    return
strcmp($a->name, $b->name);
  });
?>