Why is this PHP code to sort an array not returning the correct value?
<p>I have an array of products that I'm pulling from the db. I've verified that these are correct, using the following code:</p>

<pre><code>$unsorted_products = products::get( array( 'collection' =&gt; $collection-&gt;id ) );
die(print_r($unsorted_products));
</code></pre>

<p>...and the results are as I expect. The thing is, I need the results to basically be grouped by a parent category and category. How they're sorted within each grouping, I don't care. Given that I don't have access to change the model that is retrieving the data via SQL, I need to sort this array via PHP. I'm using the following code:</p>

<pre><code>$products = usort($unsorted_products, function ($a, $b) {
        return strcmp(
            $a-&gt;parentcategory.$a-&gt;categoryname,
            $b-&gt;parentcategory.$b-&gt;categoryname
        );
    });
</code></pre>

<p>...but dumping the <code>$products</code> array reveals that it is only holding the value 1. Any idea what I am doing wrong? I've verified that the properties I am attempting to access do exist in each object.</p>

<p>Thanks.</p>
