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. Link to comment https://forums.phpfreaks.com/topic/91528-random-number/ 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 } ?> Link to comment https://forums.phpfreaks.com/topic/91528-random-number/#findComment-468833 Share on other sites More sharing options...
shakeelstha Posted February 18, 2008 Author Share Posted February 18, 2008 thank u.... Link to comment https://forums.phpfreaks.com/topic/91528-random-number/#findComment-469426 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.