title: How to shuffle/ randomize an array and display randomed entries in php
body: <p>Good  afternoon,</p>
  <p>I am looking for a solution already few days,
  have seen a lot of material regarding shuffle and rand_array
  on stackoverflow and other pages, but could not find the right solution for me.</p>
  <p>Iam working on dynamical content for a web project.
  With the code down I am getting the data for an array $prodItems and the code is working fine.</p>
  <p>Currently I am receiving all data (over 1000+)
  Titles and images of products.</p>
  <p>What I want to get is - to display a random number (for Example 5 or 10)
  of $prod_id</p>
  <p>With other words to display randomly 5 or 10 titles and pages of products instead of 1000+</p>
  <p>I will be very thanksful if someboday could give me a code example.</p>
  <pre><code>foreach ($prodItems as $prod_id =&gt; $item) { ?&gt;
      &lt;?php echo $prod_id; ?&gt;
      &lt;?php echo $item[&quot;image&quot;]; ?&gt;
      &lt;?php echo $item[&quot;title&quot;]; ?&gt;
  &lt;?php } ?&gt;
  </code></pre>
  <p>Here ias a Example of the array if requested.</p>
  <pre><code>&lt;?php
  $prodItems = array(
  
          &quot;prod1&quot; =&gt; array(
                  &quot;title&quot; =&gt; &quot;example title 1&quot;,
                  &quot;image&quot; =&gt; &quot;path to the image 1&quot; 
              ),
          
          &quot;prod2&quot; =&gt; array(
                  &quot;title&quot; =&gt; &quot;example title 2&quot;,
                  &quot;image&quot; =&gt; &quot;path to the image 2&quot; 
              ),     
          
           &quot;prod3&quot; =&gt; array(
                  &quot;title&quot; =&gt; &quot;example title 3&quot;,
                  &quot;image&quot; =&gt; &quot;path to the image 3&quot; 
              ),
       );   
  ?&gt;
  </code></pre>