Re: Randomiser
| From: | Reese | Date: | Sun, 19 Oct 2008 23:32:14 +0000 |
| Subject: | Re: Randomiser | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282114@lists.php.net to get a copy of this message | ||
Chris wrote:
Inside the loop? I envisioned shuffling the array, then launching the loop. Probably it is possible to avoid but if shuffle fires inside the loop, reshuffling seems like it would be an issue. ReeseThat works, but shuffle() is cleaner and then you can echo things out with a foreach() expression. http://www.php.net/manual/en/function.shuffle.phpIf you're doing a shuffle inside a loop, it's going to be even slower. Might not be an issue for the OP but after your array gets to a certain size, doing that will be a problem.