Randomize sentences into a phrase using PHP functions
I was looking for a while to find a sentence randomizer from a phrase and I didn’t find anything. There are scripts for randomize words but for clauses nothing. I don’t know php but with little (little bit more actually) help I did it.
Copy this code into a webpage, replace the phrase with yours and you will have at every page refresh a new phrase. The sentences will rotate random, in no specific order.
[sourcecode language='php']
< ?
$phrase = 'What does pride in your work have to do with stopping support for IE6. A browser that debuted EIGHT years ago. This is ridiculous. Any developer that continues to create hack or workarounds for this abysmal browser should lose their job.';
$sentences = explode("." , $phrase);
shuffle ($sentences);
foreach ($sentences as $element) {
echo $element . ". ";
}
?>[/sourcecode]
Don’t forget, after you paste the code to replace the line numbers. Unfortunately I couldn’t find any way to remove it.
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.


Thanks a million man. You don’t know how timely this was for me.