Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

The saying that changes under the logo


ghost's Avatar
0 0

Hey, I'm designing a web page, and i was wondering how they got the saying under the logo to change every time you reload the page. I would like to have the same thing in my web page


ghost's Avatar
0 0

random number generator + array full of sayings.

Fill the array with a textfile btw (like fortune).


ghost's Avatar
0 0

… or, if you want to really make it interesting:

Get an array of subjects, array of verbs, and array of predicates, and use those to randomly generate "quotes". Then, use the names of famous politicians of the past to attribute the "quote" for bonus humor points.


ghost's Avatar
0 0

define wrote: … or, if you want to really make it interesting:

Get an array of subjects, array of verbs, and array of predicates, and use those to randomly generate "quotes". Then, use the names of famous politicians of the past to attribute the "quote" for bonus humor points.

To make it even better use a markov chain. Anyways, here's some code

$file = file_get_contents('file.txt');
$lines = explode("\n",$file);
echo $lines[mt_rand(0,count($lines)-1)]."\n";
?>

Will read lines from "file.txt" and print out a random line.