Will anyone help me make this into a random word generator that makes three random words like this:
RandomWord1 RandomWord2 -(dash) RandomWord3
Right now I'm using three PHP files like this
Code:
<?
$delim = "\n";
$quotefile = "quotes1.txt";
$fp = fopen($quotefile, "r");
$contents = fread($fp, filesize($quotefile));
$quote_arr = explode($delim,$contents);
fclose($fp);
srand((double)microtime()*1000000);
$quote_index = (rand(1, sizeof($quote_arr)) - 1);
$herequote = $quote_arr[$quote_index];
echo $herequote;
?> And linking all 3 of them to my page with 'include'
Like this
Code:
<? include("quote1.php"); ?>
<? include("quote2.php"); ?>
-<? include("quote3.php"); ?> Which is really a hassle, since I know that all three of these could be together..
I was wondering if anyone could help me kinda merge all 3 PHP files into one simple script so I would only have to 'include' one PHP script that displays all three random words (the third seperated from the rest by a dash).
I'm a total PHP newbie so please try not to laugh.
Thanks
EDIT: Oh, and basically the quote1.txt, quote2.txt, and quote3.txt files that I am using to get my random quotes from use a single quote on every line and pick a random line for each quote.. I would like to have one PHP script that takes the random words from 3 seperate text files and picks a random line to display from the .txt file.
Bet I confused you even more.. Sorry.