note 72721 added to function.dechex
| From: | AsakuraStar at osu1 dot php dot net | Date: | Wed, 31 Jan 2007 01:25:05 +0000 |
| Subject: | note 72721 added to function.dechex | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122384@lists.php.net to get a copy of this message | ||
If you want a simple function to convert RGB Colors to HEX Colors that you can use on your website,
try this:
<?php
function rgbhex($red,$green,$blue) {
$red = dechex($red);
$green = dechex($green);
$blue = dechex($blue);
return "#".strtoupper($red.$green.$blue);
}
//Let's Check out using the following colors:
//Red: 118; Green: 251; Blue: 85
echo rgbhex(118,251,85);
//Result: #76FB55
?>
----
Server IP: 69.147.83.197
Probable Submitter: 201.79.80.18
----
Manual Page -- http://www.php.net/manual/en/function.dechex.php
Edit -- https://master.php.net/note/edit/72721
Del: integrated -- https://master.php.net/note/delete/72721/integrated
Del: useless -- https://master.php.net/note/delete/72721/useless
Del: bad code -- https://master.php.net/note/delete/72721/bad+code
Del: spam -- https://master.php.net/note/delete/72721/spam
Del: non-english -- https://master.php.net/note/delete/72721/non-english
Del: in docs -- https://master.php.net/note/delete/72721/in+docs
Del: other reasons-- https://master.php.net/note/delete/72721
Reject -- https://master.php.net/note/reject/72721
Search -- https://master.php.net/manage/user-notes.php