Gw Temp

Menu

Tutorial - 'Random Quotes' by rpgsmo

An item about Programming Languages posted on

Blurb

Very short and simple tutorial covering how to make random quotes in PHP.

Body

To do this is actually very very very simple, all it requires is the rand() function, which generates a random number, like this:

rand(1,5);


This generates a random number between 1 and 5, See? Isn't that extremely simple?

Here is an example:


$quote = rand(1,5);

if ($quote == 1) {
print "Insert First quote here";
}
if ($quote == 2) {
print "Second quote here";
}
//the rest of the if functions here
?>


It's as easy as that, any problems? Contact me.

To find more tutorials like this, visit:
http://bullzeyeproduction.net