Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

php Random quote

Sun Oct 26, 2008 6:08 pm

Displays a random quote on a web page. Quotes are picked from a list that you define.
Code:
?php

/**
 * Add this line of code in your page:
 * <?php include "random_quote.php"; ?>
 */

$quotes[] = "This is a quote";
$quotes[] = "This is another";
$quotes[] = "quote 3";
$quotes[] = "quote 4";
$quotes[] = "quote 5";
$quotes[] = "quote 6";

srand ((double) microtime() * 1000000);
$randomquote = rand(0,count($quotes)-1);

echo "<p>" . $quotes[$randomquote] . "</p>";

?>




Post a reply
  Related Posts  to : php Random quote
 Random To File     -  
 Random to File     -  
 php Random image     -  
 Generating Random Number in java     -  
 random forest algorithm classifier     -  
 Pick one or more random entries out of an array     -  
 Random Search for tuning classifier parameters     -  
 Get the important variables of random forest classifier     -  
 Applet Game To Shot a Random Ball     -  
 Random Forest Classification (Binary )- Supervised Learning     -  

Topic Tags

PHP Date