Mornin all 🙂
I'm trying to create a script that will take the letters from a word, scramble them, and then output the scrambled letters. I came up with this, but it's not working. Can anyone offer some insight?
$word = "good morning";
$a = array(); for($i=0;$i<strlen($word);$i++) $a[] = substr($word, $i, 1);
$a = shuffle($a);
echo $a[0];
ALSO >> Is it possible to have PHP preserve the spaces in between the words? I'm thinking this is possible by exploding the variable by the spaces, shuffling each of the words, and then outputting the scrambled words in the original order.
I have NO idea how to do this though :/