Title: PHP Random FONT Color Function
Contributor: Alex Verstraeten (aka zxc)
PHP Tip: 1701
<?
error_reporting(0);
function rcolor() {
srand((double)microtime()*10000000);
$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;
}
?>
<html>
<body bgcolor="#FFFFFF">
<h3>
<?
echo rand_color("This is an example of my rand_color() function on a long string");
?>
</h3>
</body>
</html>
Anyone who wishes to make additions or changes to this
PHP Tip email them to webmaster@linuxguruz.org
This document is Copyright (c) 1999, 2000 by LinuxGuruz