note 73397 added to function.dechex
| From: | jon at ovbb dot org | Date: | Wed, 21 Feb 2007 16:05:44 +0000 |
| Subject: | note 73397 added to function.dechex | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123648@lists.php.net to get a copy of this message | ||
@poj and AsakuraStar,
You're probably better off doing this instead to get what you want:
<?php
function rgbhex($red, $green, $blue)
{
return sprintf('#%02X%02X%02X', $red, $green, $blue);
}
echo rgbhex(15, 15, 15); // prints #0F0F0F
?>
It's cleaner and most likely faster. May not even want to encapsulate it in a function, as
it's just a one-liner.
----
Server IP: 64.71.164.2
Probable Submitter: 69.254.177.174
----
Manual Page -- http://www.php.net/manual/en/function.dechex.php
Edit -- https://master.php.net/note/edit/73397
Del: integrated -- https://master.php.net/note/delete/73397/integrated
Del: useless -- https://master.php.net/note/delete/73397/useless
Del: bad code -- https://master.php.net/note/delete/73397/bad+code
Del: spam -- https://master.php.net/note/delete/73397/spam
Del: non-english -- https://master.php.net/note/delete/73397/non-english
Del: in docs -- https://master.php.net/note/delete/73397/in+docs
Del: other reasons-- https://master.php.net/note/delete/73397
Reject -- https://master.php.net/note/reject/73397
Search -- https://master.php.net/manage/user-notes.php