PHP Code: 16 binary color converted to RGB color value, this article source: Mango station.
Copy to ClipboardWhat to refer to: [www.bkjia.com]
/**
* 16 binary color converted to RGB color value
* @method Hex2rgb
*/
function Hex2rgb ($hexColor) {
$color = Str_replace (' # ', ' ', $hexColor);
if (strlen ($color) > 3) {
$rgb = Array (
' R ' = Hexdec (substr ($color, 0, 2)),
' G ' = Hexdec (substr ($color, 2, 2)),
' B ' = Hexdec (substr ($color, 4, 2))
);
} else {
$color = Str_replace (' # ', ' ', $hexColor);
$r = substr ($color, 0, 1). substr ($color, 0, 1);
$g = substr ($color, 1, 1). SUBSTR ($color, 1, 1);
$b = substr ($color, 2, 1). SUBSTR ($color, 2, 1);
$rgb = Array (
' R ' = Hexdec ($r),
' G ' = Hexdec ($g),
' B ' = Hexdec ($b)
);
}
return $RGB;
}
?>
http://www.bkjia.com/PHPjc/363860.html www.bkjia.com true http://www.bkjia.com/PHPjc/363860.html techarticle PHP Code: 16 binary color converted to RGB color value, this article source: Mango station. Copy to Clipboard references: [www.veryhuo.com]? PHP/** * 16 binary color converted to RGB color value ...