//Variables
//$Titlestring = The string used as a title for the Dada reading
//$Usertext = the supplied text to read from
//$Outputstring = starts with a string from the start of the text to be travestied the length of the variable Garbledness
//$Titleiteration if the length of output is longer than the number of characters in the title we need to keep a count of the number of loops
//Inputpointer keeps track of were we are in the $Usertext for the next word to search for.
$Titlestring = htmlspecialchars($_POST['titletext']);
$Usertext = strtolower(htmlspecialchars($_POST['usertext']));
$Linesize = htmlspecialchars($_POST['linesize']);
$Outputarray = array();
$Outputstring = "";
//Clean up the user text by removing all punctuation
$Usertext = trim(preg_replace('#[^\p{L}\p{N}]+#u', ' ', $Usertext));
//Strip off slashes
//$Usertext = stripslashes($Usertext);
// Remove newlines
//$string = str_replace("\n", "", $Usertext);
//$string = str_replace("\r", "", $Usertext);
//Breakdown user text into an array
$Usertextarray = explode(" ", $Usertext);
//Start loop to create the dada generation
while(count($Usertextarray) > 0)
{
$index = mt_rand(0,count($Usertextarray)-1);
$Outputarray[] = $Usertextarray[$index];
//Remove item from $Usertextarray
unset($Usertextarray[$index]);
//Clear empty element
$Usertextarray = array_values($Usertextarray);
}
//Build the output string
$Linelength = 0;
for($i=0;$i';
echo $Titlestring;
echo '
'; echo ''; ?>
'; echo ''; ?>