note 35843 added to function.dechex
| From: | huda m elmatsani | Date: | Tue, 16 Sep 2003 19:36:00 +0000 |
| Subject: | note 35843 added to function.dechex | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-56583@lists.php.net to get a copy of this message | ||
Create Random Hex Color:
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((double) $usec * 100000);
}
function rand_hex() {
mt_srand(make_seed());
$randval = mt_rand(0,255);
//convert to hex
return sprintf("%02X",$randval);
}
function random_color(){
return "#".rand_hex().rand_hex().rand_hex();
}
hme ;)
----
Manual Page -- http://www.php.net/manual/en/function.dechex.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35843
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35843&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35843&report=yes