title: How to randomly take examples from arrays, shuffle them and place them into a new array to be formatted as a list
body: <p>In a <a href="https://stackoverflow.com/questions/18242012/how-do-you-store-random-parts-of-an-array-within-an-array-and-then-print-as-a-li">previous question</a> I didn't realize that I wouldn't be able to add in the rest of the changes myself, so here is what I'm working with. User webfix helped me get this:</p>
  
  <pre><code>$mars = array ('How big is Mars?', 'How many moons does Mars have?', 'How far away is Mars?', 'What is the highest point on Mars?');
  $jupiter = array ('How big is Jupiter?', 'How many moons does Jupiter have?', 'How far away is Jupiter?', 'What is the highest point on Jupiter?');
  $earth = array ('How big is Earth?', 'How many moons does Earth have?', 'How far away is Earth?', 'What is the highest point on Earth?');
  $sun = array ('How big is the Sun?', 'How many moons does the Sun have?', 'How far away is the Sun?', 'What is the highest point on the Sun?');
  
  $all = array($mars, $jupiter, $earth, $sun);
  
  function createList($a)
  {
  echo "&lt;ul&gt;";    
  foreach ($a as $array) 
      {
      $questions = count($array);
      $idquestion = rand(0, $questions-1);
      echo "&lt;li&gt;" . $array[$idquestion]  . "&lt;/li&gt;";
      }
  echo "&lt;/ul&gt;";
  }
  
  createList($all);
  </code></pre>
  
  <p>I now want to add to this a randomization of the order of questions as well as a maximum of three (or any number to be changed later) questions spit out.</p>
  
  <p>It currently will choose one of each question ($mars, $jupiter, $earth, $sun) and then make it into a list in that order. I want the order to be randomized and for only three of them to be chosen.</p>
  
  <p>I tried to use "shuffle ($all)", but that didn't work and maybe we could use something like the "for ($i = 1; $i &lt; 4; $i++)" to make it stop after picking three? Thanks.</p>