note 79163 added to function.hexdec
| From: | Anonymous at osu1 dot php dot net | Date: | Wed, 14 Nov 2007 04:34:38 +0000 |
| Subject: | note 79163 added to function.hexdec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132248@lists.php.net to get a copy of this message | ||
// Função GET Cor Hexadecima e Retorna em RGB
function hexrgb($hexstr, $rgb) {
$int = hexdec($hexstr);
switch($rgb) {
case "r":
return 0xFF & $int >> 0x10;
break;
case "g":
return 0xFF & ($int >> 0x8);
break;
case "b":
return 0xFF & $int;
break;
default:
return array(
"r" => 0xFF & $int >> 0x10,
"g" => 0xFF & ($int >> 0x8),
"b" => 0xFF & $int
);
break;
}
}// END GET Cor Hex => RGB
//Uso
echo hexrgb("1a2b3c", r); // 26
echo hexrgb("1a2b3c", g); // 43
echo hexrgb("1a2b3c", b); // 60
//ou
var_dump(hexrgb("1a2b3c", rgb)); //array(3) { ["r"]=> int(26)
["g"]=> int(43) ["b"]=> int(60) }
----
Server IP: 69.147.83.197
Probable Submitter: 200.247.156.186
----
Manual Page -- http://www.php.net/manual/en/function.hexdec.php
Edit -- https://master.php.net/note/edit/79163
Del: integrated -- https://master.php.net/note/delete/79163/integrated
Del: useless -- https://master.php.net/note/delete/79163/useless
Del: bad code -- https://master.php.net/note/delete/79163/bad+code
Del: spam -- https://master.php.net/note/delete/79163/spam
Del: non-english -- https://master.php.net/note/delete/79163/non-english
Del: in docs -- https://master.php.net/note/delete/79163/in+docs
Del: other reasons-- https://master.php.net/note/delete/79163
Reject -- https://master.php.net/note/reject/79163
Search -- https://master.php.net/manage/user-notes.php