05-07-2008, 12:10 PM
|
#11 (permalink)
|
|
The Prestige
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
|
Quote:
Originally Posted by Salathe
sketch, your first code snippet has an off-by-one error related to the $cnt variable. It needs to be count()-1 for the loops and calls to rand else you'll get " Undefined offset" notices.
Also, what's the harm in using something like the following instead of the longer, looping code snippet?
PHP Code:
$words = 'I took my dog for a walk';
$shuffled = explode(' ', $words);
shuffle($shuffled);
echo implode(' ', $shuffled);
|
Niw, to be honest, thats what I was thinking all along, but I didn't think it work :S
__________________
VillageIdiot can have my babbies ;d
|
|
|
|