You can use the following code to print a random element from PHP array:
<?php
$colors = array("red", "blue", "green", "yellow", "orange", "brown", "white", "black");
$colorslen = sizeof($colors) - 1;
$rcolor = $colors[rand(0, $colorslen)];
print $rcolor;
?>
|