Description
Contains an array of words. Randomly chooses two different words from the array. Prints the two words, followed by the brand word.
Run
| View code [+] |
Create a snippet based on this »
View in new window »
// what words to choose from?
$words = array
(
"citywords"=>array
(
"capacity," "electricity," "publicity," "simplicity,""velocity," "felicity," "specificity," "elasticity," "multiplicity," "ethnicity," "toxicity," "complicity," "ferocity," "authenticity," "atrocity," "scarcity," "reciprocity," "incapacity," "eccentricity," "opacity," "tenacity," "domesticity," "duplicity," "intercity," "historicity," "audacity"
),
);
$numberofwordsinarray=26;
$brandword = "coworkcity";
// choose the words!
$randomword1 = rand(0, $numberofwordsinarray-1);
$randomword2 = rand(0, $numberofwordsinarray-1);
if($randomword2==$randomword1) {$randomword2 = rand(0, $numberofwordsinarray-1);} // if $randomword2 still equals $randomword1 then rock on
// print the words!
echo ($words[$randomword1])."<br>".($words[$randomword2])."<br>".$brandword;
Comments (0) | View comments for all versions (0)
Log in if you have a Kogbox account.