eRott Posted May 15, 2008 Share Posted May 15, 2008 Hey, Okay, I have an array containing a bunch of links and a script which pulls out of one these random links and echo's it. However, I am having a bit of trouble. I need to pull 4 of them at a time and I cannot pull any one of them more then once. Any idea's? I'm thinking of a while loop or something similar. Thanks and take care. <?php $tags[] = "<a href=\"#\" class=\"#\"></a>"; $tags[] = "<a href=\"#\" class=\"#\"></a>"; $tags[] = "<a href=\"#\" class=\"#\"></a>"; $tags[] = "<a href=\"#\" class=\"#\"></a>"; $tags[] = "<a href=\"#\" class=\"#\"></a>"; $tags[] = "<a href=\"#\" class=\"#\"></a>"; $tags[] = "<a href=\"#\" class=\"#\"></a>"; $tags[] = "<a href=\"#\" class=\"#\"></a>"; $tags[] = "<a href=\"#\" class=\"#\"></a>"; $tags[] = "<a href=\"#\" class=\"#\"></a>"; $tag_count = count($tags) - 1; $tag = $tags[rand(0,$tag_count)]; echo '<li>'.$tag.'</li>'; ?> Link to comment https://forums.phpfreaks.com/topic/105684-solved-rand/ Share on other sites More sharing options...
kenrbnsn Posted May 15, 2008 Share Posted May 15, 2008 Take a look at the array_rand(). Ken Link to comment https://forums.phpfreaks.com/topic/105684-solved-rand/#findComment-541478 Share on other sites More sharing options...
eRott Posted May 15, 2008 Author Share Posted May 15, 2008 Well now. That certainly is a lot easier then what I was planning on trying. Thank you kindly! Take care. Link to comment https://forums.phpfreaks.com/topic/105684-solved-rand/#findComment-541480 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.