Page 1 of 1

PHP Random FONT Color Function

New postPosted: Sat Dec 28, 2013 3:50 pm
by Cat
Code: [Select all] [Expand/Collapse] [Download] (Untitled)
function rcolor() {
$rand = (rand(30,170));
return sprintf("%02X","$rand");

function rand_color($string) {
$array = explode(" ",$string);
$j = count($array);
for ($i=0;$i<$j;$i++) {
$return .= '<font color="#'.rcolor().rcolor().rcolor().'">'.$array[$i].' </font>'; }
return $return;

<body bgcolor="#FFFFFF">
<?php echo rand_color("This is an example of my rand_color() function on a long string"); ?>


Anyone who wishes to make additions or changes to this tutorial email them to