Simple function to parse RGB value

Here’s a simple function to parse RGB string (#00ff00) into array, so it can be used in GD functions.
Hope it can save a little time for you.


list($r, $g, $b)= parse_RGB("#123456");

function parse_RGB($color)
{
$r= hexdec(substr($color, 1, 2));
$g= hexdec(substr($color, 3, 2));
$b= hexdec(substr($color, 5, 2));
return array($r, $g, $b);
}

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer