DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Eric has posted 2 posts at DZone. View Full User Profile

PHP > Get Random String Function

08.12.2009
| 4769 views |
  • submit to reddit
        // Simple static function for retrieving random quotes. I used this on the first version of my website http://ericfickes.com/v1/

<?php 

/**
* Get a random quote
*/
public static function get_rand_title()
{
	//load up the quotes
	$aQuotes = array(
		"Eric Fickes -> Keeping it real since I can remember", 

		"Eric Fickes -> No worries, Skull and Crossbones", 

		"Eric Fickes -> Own it like you bought it.  Spank it like you made it.", 

		"Eric Fickes -> Of course it's slow.  It's a ridiculous query!", 

		"Eric Fickes -> Remember when Radio Shack was the bomb?", 

		"Eric Fickes -> Of course it's slow.  It's a ridiculous query!", 

		"Eric Fickes -> What's five and five?!?!?", 

		"Eric Fickes -> Of course it's slow.  It's a ridiculous query!"
	);

	return $aQuotes[ rand( 0, count($aQuotes)-1 ) ];
}

?>