I want to create a jumble game that randomly selects a word from a text file and jumbles it.
This is the code:
<?php
error_reporting(E_ALL);
$filename = "words4jumble.txt";
$fp = fopen($filename, "r");
$filecontents = fread($fp, filesize($filename));
fclose($fp);
$exploded = explode(":", $filecontents);
$size = sizeof($exploded)-1;
$num = rand(0, $size);
$word = str_shuffle($exploded[$num]);
print "Your word is $word. Have fun! <form name=\"jumble\" method=\"post\"
action=\"jumblecheck.php\"><input name=\"realword\" type=\"hidden\" value=\"$exploded[$num]\">";
?>
<input type="text" name="wordunjumble"><p><input type="reset">
<input type="submit" value="I solved it!">
</form>
I get a fatal error saying that str_shuffle() was called to an undefined function. Please help me! I have attached a text file with the words if it's any help at all.