Website Scripts And Cloud Tutorials

Display random quotes using php

Byadmin

Aug 29, 2013 ,

Last updated on May 10th, 2016 at 12:36 pm

Click to rate this tutorial!
[Total: 0 Average: 0]

Display random quotes using php

This is a very simple script that display text or quotes randomly on page refresh.
The quotes will get displayed randomly when the user visits the webpage each time.

<?php
$quote = array(  
1  => "Text To Display 1",  
2  => "Text To Display 2",  
3  => "It Works Display 3",  
4  => "The Next Display 4",  
5  => "Again Display 5",  
6 => "Visit Mistonline.in For All Kind Of Tutorials Display 6"  
);   
$randnum = rand(1,6);  
echo "<div id='random' style='border:solid 1px; padding:5px; margin:5px;'>Random Quote - <b>$quote[$randnum]</b></div>";   
?> 
Click to rate this tutorial!
[Total: 0 Average: 0]
One thought on “Display random quotes using php”

Leave a Reply

Your email address will not be published.