title: PHP usort won't sort class
body: <p>This is a sample of the array of elemnts to sort:</p>
  
  <pre><code>$items = 
      array
        0 =&gt; 
          object(stdClass)[8]
            public 'id' =&gt; string '110' (length=3)
            public 'brand_id' =&gt; string '18' (length=2)
              array
                0 =&gt; string ' OT-708' (length=7)
            public 'failed' =&gt; null
            public 'diff' =&gt; null
        1 =&gt; 
          object(stdClass)[9]
            public 'id' =&gt; string '161' (length=3)
            public 'brand_id' =&gt; string '18' (length=2)
  </code></pre>
  
  <p>So, let's say I want to sort by <code>brand_id</code>.
  This is my usort callback function:</p>
  
  <pre><code>function _compare($itemA, $itemB){
  
      if ($itemA-&gt;brand_id == $itemB-&gt;brand_id) {
  
          return 0; 
      }
      else{
          return strcmp($itemA-&gt;brand_id, $itemB-&gt;brand_id); //just an example...
      }
  
  }
  </code></pre>
  
  <p>And when I do <code>usort($items, '_compare'); var_dump($items);</code> nothing happens. Any clues on how to troubleshoot this?</p>
  
  <p><strong>--UPDATE--</strong></p>
  
  <p>Ok, I've simplified the problem to this:</p>
  
  <pre><code>function cmp($itemA, $itemB){
      return -1;
  }
  
  if (usort($items, "cmp"))
                  echo 'I just sorted!';
  else echo 'Cant sort!';
  </code></pre>
  
  <p>It always prints '<strong>Cant sort!</strong>'</p>