Title: Randomizing Text With PHP
Author: LeeDavis
Category: CODING
Published: 2017-02-26 13:45:29
Clicks: 174
This is a quickie coding for the process of being able to have differing text (with hyperlink ability as well) upon each page refresh for a rotating series of messages appearing randomly.

The coding for the template is;
< ?php
srand((float) microtime() * 10000000);
$input = array("BaseKeyword", "Keyword1", "Keyword2", "Keyword3", "Keyword4");
$rand_keys = array_rand($input, 2);
echo $input[$rand_keys[0]] . "n";
echo $input[$rand_keys[1]] . "n";
? >

TEXT EXAMPLE:
< ?php
srand((float) microtime()* 10000000);
$input = array(" < h2 >< a href="http://yoursite.com/">Your Website Keyword Here< /a >< /h2 >
< img src="/images/yourimage.jpg" alt="Keyword of your choice - Description relevant to the keyword here." width="200" height="153" align="right" border="1" hspace="6" / >
? >

This is an excellent description of your content. Everything you could want to know about your keyword is here including: Which keyword to buy for all issues relevant to it. All the information you will require is right here in this one place.
< p >< a href="/views/mysite">Please click here to read this wonderful example.< /a >< /p >

< ?php
("BaseKeyword","Keyword1", "Keyword2","Keyword3","Keyword4");
$rand_keys = array_rand($input,2);
echo $input[$rand_keys[0]] . "n";
echo $input[$rand_keys[1]] . "n";
? >