title: PHP explode array
body: <p>I'm trying to get random values out of an array and then break them down further, here's the initial code:</p>
  
  <pre><code>$in = array('foo_1|bar_1', 'foo_2|bar_2','foo_3|bar_3','foo_4|bar_4','foo_5|bar_5' );
  $rand = array_rand($in, 3);
  
  $in[$rand[0]]; //foo_1|bar_1
  $in[$rand[1]]; //foo_3|bar_3
  $in[$rand[2]]; //foo_5|bar_5
  </code></pre>
  
  <p>What I want is same as above but with each 'foo' and 'bar' individually accessible via their own key, something like this:</p>
  
  <pre><code>$in[$rand[0]][0] //foo_1
  $in[$rand[0]][1] //bar_1
  
  $in[$rand[1]][0] //foo_3
  $in[$rand[1]][1] //bar_3
  
  $in[$rand[2]][0] //foo_5
  $in[$rand[2]][1] //bar_5
  </code></pre>
  
  <p>I've tried exploding $rand via a foreach loop but I'm obviously making some n00b error:</p>
  
  <pre><code>foreach($rand as $r){
  $result = explode("|", $r);  
  $array = $result;
  }
  </code></pre>