Breaking News
Home / Web / PHP / PHP Snippets / Display Random Quotes on Website using Php

Display Random Quotes on Website using Php

Random Quotes in PHPSome website display random quotes to its visitors on various pages. The following snippet shows how to display a random quote(when ever the function is invoked) out of list of quotes that are pre populated into the arrary.

As a further extension the quotes can be loaded from a newline delimited file (one quote per line) or from a database and then stored into global variable array which can be passed into this get_random_quotes function to get the next random quote.


Check Also

How to list files in a directory in PHP?

<?php if ($handle = opendir(‘/path/to/directory’)) {     echo "Directory handle: $handlen";     echo …

Advertisment ad adsense adlogger