shakeelstha Posted February 17, 2008 Share Posted February 17, 2008 I have an array of numbers. I need to get the random number (random index) from the array. The number picked before should not be picked the next time. How can I do that. Quote Link to comment Share on other sites More sharing options...
Barand Posted February 17, 2008 Share Posted February 17, 2008 <?php $bag = array(1,2,3,4,5); shuffle ($bag); // shake the bag for ($i=0; $i<5; $i++) { echo array_pop($bag); // pull from the bag } ?> Quote Link to comment Share on other sites More sharing options...
shakeelstha Posted February 18, 2008 Author Share Posted February 18, 2008 thank u.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.