note 91534 modified in function.rand by danbrown
| From: | danbrown@php.net | Date: | Tue, 16 Jun 2009 14:38:26 +0000 |
| Subject: | note 91534 modified in function.rand by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156920@lists.php.net to get a copy of this message | ||
I thought this function (random color) might be of use to someone [to create and return a random hex
for HTML colors]:
function get_random_color()
{
for ($i = 0; $i<6; $i++)
{
$c .= dechex(rand(0,15));
}
return "#$c";
}
--was--
I thought this function (random color) might be of use to someone:
function get_random_color()
{
for ($i = 0; $i<6; $i++)
{
$c .= dechex(rand(0,15));
}
return "#$c";
}
http://php.net/manual/en/function.rand.php