Help needed for Shuffle multidimensional array
Posted: Sat Jun 06, 2009 11:46 pm
I wanted to shuffle/randomize the multidimensional array before the content being displayed. Can you help me with this?
Appeciate your help.
Thanks
Chris
Code: Select all
<?php
$news = array(
array('item_title'=>'cnn', 'item_name'=>'news network'),
array('item_title'=>'espn', 'item_name'=>'sports network'),
array('item_title'=>'hbo', 'item_name'=>'movie network')
);
/*** How to shuffle/randomize the above multidimensional array as i dont want display the elements in the same order
cnn-news network, espn-sports network, hbo-movie network ***/
/*** loop over the array ***/
foreach( $news as $item )
{
echo $item['item_title'].'-'.$item['item_name'].'<br />';
}
?>
Thanks
Chris