Version: 1.0
Type: Sample Code (HOWTO)
Category: Math Functions
License: GNU General Public License
Description: This is a PHP application that generates random quotes stored in array and streamd it back to the browser
<html> <head> <title>Random Quote Generation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> <font color="#0033FF">The following is the php code for random quote generation using the functionality of arrays : </font> <code> <p><?php</p> <p>srand((float) microtime() * 10000000);<br> // Quotes go inside the array<br> $quote = array("Hi! How are you ?", "Hey! Good to see you !", "Hey Man ! How are you doin?","Have'nt we met before!");<br> // Random quote is generated by array_rand and the variable is assigned to it<br> //The number in the parenthesis = number of quotes you have in total<br> $echo = array_rand($quote,4);</p> <p>?></p> <p><center> <h2><br> <?</p> <p>echo $quote[$echo[1]];<br> ?><br> </h2><br> <center></p> </code> </body> </html>