title: Shuffle objects in PHP
body: <p>How can I sort an object in PHP? I tried <code>shuffle()</code> but that expects an array:</p>
  
  <pre><code>Warning: shuffle() expects parameter 1 to be array, 
  object given in /var/www/index.php on line 366
  
  Warning: Invalid argument supplied for foreach() in /var/www/index.php on line 334
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>public function updateStatusWithoutDB() {
      $this-&gt;updateProfileColors();
      $items = $this-&gt;getItems();
      $items = shuffle($items);
      if($this-&gt;updateStatusArray($items))
          return true;
      return false;
  }
  </code></pre>
  
  <p>A <code>var_dump($items);</code> returns this:</p>
  
  <pre><code>["180"]=&gt;
      object(stdClass)#203 (1) {
        ["status"]=&gt;
        string(130) "I was checking Microsoft's Visual Studio page just no…"
      }
  </code></pre>