title: mixing an array within a PHP foreach loop
body: <p>I'm trying to display an array in a random order in a foreach loop in PHP. I don't know whether to create a randomizing loop to do this or whether there is a randomizing function. I'm capturing information from the Facebook and twitter api's with the goal to mix the results and display as a list of comments from Facebook wall and tweets from twitter.</p>
  
  <p>As you can see below, I first merge the two arrays from Facebook and twitter into one, and then loop through them in a foreach loop to display. currently all the Facebook one show first, and then twitter. I want to mix the two randomly. Sorry about the code, I hacked it together pretty quickly.</p>
  
  <p>If you've got a totally different way to do this as well please don't hold back, I'm all ears! ;) </p>
  
  <p>Here is what I have code wize:</p>
  
  <pre><code>$array = array_merge ($comments, $tweets);
  foreach ($array as $commentortweet) 
  {
      echo '&lt;li&gt;'. $commentortweet-&gt;picture. $commentortweet-&gt;message . $commentortweet-&gt;updatetime . 
          $commentortweet-&gt;content. $commentortweet-&gt;user . $commentortweet-&gt;author .'&lt;/li&gt;';
  }
  echo '&lt;/ul&gt;'; 
  </code></pre>