rockinaway Posted January 12, 2011 Share Posted January 12, 2011 If I have an array, $array, how can I loop through it (e.g. with a foreach() ) .. but just do it randomly? So each time, random entries of the array are used and not necessarily in order. Link to comment https://forums.phpfreaks.com/topic/224224-loop-through-array-but-randomly/ Share on other sites More sharing options...
Pikachu2000 Posted January 12, 2011 Share Posted January 12, 2011 You could shuffle it before looping through it. Link to comment https://forums.phpfreaks.com/topic/224224-loop-through-array-but-randomly/#findComment-1158536 Share on other sites More sharing options...
rockinaway Posted January 12, 2011 Author Share Posted January 12, 2011 Yup, just found it. thanks Link to comment https://forums.phpfreaks.com/topic/224224-loop-through-array-but-randomly/#findComment-1158537 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.