Ads
Randomize Certain Content
With this tutorial you will learn how to display random quotes you specify within the php file.
You can imput anything, not just quotes. It could be videos, music, images, and whatever else too!
Example Code:
CODE
<?php
//Your Quotes
$q[] = '"Quote #1"';
$q[] = '"Quote #2"';
$q[] = '"Quote #3 "';
$q[] = '"Quote #4"';
$q[] = '"Quote #5 "';
//Get all quotes displayed above
$n_q = count($q) - 1;
//The ' random function '.
$q_n = rand(0, $n_q);
//Picks a random number from the quotes list.
echo $q[$q_n];
?>
Now put that code into a file named whatever.php and run it. Refresh for a random quote each time!
Any questions please comment! :)
Sunday May 27, 2007 - 89 reads