PHP-Multidimensional array with foreach loop and show only 9 values out of 15 in random order
<p>I have a Multidimensional array with foreach loop,which shows only 9 values out of 15 in random order<br>
//Array Values</p>

<pre><code>$sponsors = array(
    array('facebook','The biggest social network in the world.','http://www.facebook.com/'),
    array('adobe','The leading software developer targeted','http://www.adobe.com/'),
    array('microsoft','One of the top software companies','http://www.microsoft.com/'),
    array('sony','A global multibillion electronics','http://www.sony.com/'),
    array('dell','One of`enter code here` the biggest computer','http://www.dell.com/'),
    array('ebay','The biggest online auction and shopping websites.','http://www.ebay.com/'),
    array('digg','One of the most popular web 2.0 social networks.','http://www.digg.com/'),
    array('google','The company that redefined web search.','http://www.google.com/'),
    array('ea','The biggest computer game manufacturer.','http://www.ea.com/'),
    array('mysql','The most popular open source database engine.','http://www.mysql.com/'),
    array('hp','One of the biggest computer manufacturers.','http://www.hp.com/'),
    array('yahoo','The most popular network of social media portals','http://www.yahoo.com/'),
    array('cisco','The biggest networking and communications techno','http://www.cisco.com/'),
    array('vimeo','A popular video-centric social networking site.','http://www.vimeo.com/'),
    array('canon','Imaging and optical technology manu facturer.','http://www.canon.com/'));

//Shuffling the values
shuffle($sponsors);

//To process all values
foreach($sponsors as $company)
{
  if(isset($company[0]) &amp;&amp; !in_array($company[0],$sponsors))
     {//to print only 9 values out of 15
      for($j=1; $j&lt;=9; $j++)
      {
        echo'
           &lt;div class="sponsor" title="Click to flip"&gt;
           &lt;div class="sponsorFlip"&gt;
           &lt;img src="img/sponsors/'.$company[0].'.png" alt="More about '.$company[0].'" /&gt;
           &lt;/div&gt;
           &lt;div class="sponsorData"&gt;
           &lt;div class="sponsorDescription"&gt;'.$company[1].'&lt;/div&gt;
           &lt;div class="sponsorURL"&gt;&lt;a href="'.$company[2].'"&gt;'.$company[2].'&lt;/a&gt;
           &lt;/div&gt;
           &lt;/div&gt;
           &lt;/div&gt;
          ';
      }
      }
}//end of for each
</code></pre>
