Linkbeet

Jump to content.

PHP: HEX-Farbcode in RGB-Farbcode umwandeln

Mit folgender PHP-Funktion lässt sich HEX-Farbcode in RGB-Farbcode umwandeln:

function hex2dec($hex) {
$color = str_replace("#", "", $hex);
$ret = array(
"r" => hexdec(substr($color, 0, 2)),
"g" => hexdec(substr($color, 2, 2)),
"b" => hexdec(substr($color, 4, 2))
);
return
$ret;
}

// Beispiel:
print_r(hex2dec(“3D58BE”));

0 comments

Einen Kommentar hinterlassen

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Read more

«
»