PHP coding help

Hello. I actually want to make a program that prints a single string output from a set of different (around 3 or 4) string outputs by randomly picking one. But how will I do it?

Hi there,

I just knocked up this bit of code quickly. See if you can adapt this to your needs:
$strings = array(
“test string 1”
, “second test string”
, “another test string”
, “final test string”
echo $strings[rand(0,count($strings)-1)];

Sponsor our Newsletter | Privacy Policy | Terms of Service