the rgborhex function is returing an undefined variable:
function rgborhex($unformatedColor){
if(strpos($unformatedColor, "-") == false) { //did not find a - in the color string; is not in rgb form; convert
$rgbColor = hextorgb($unformatedColor);
$rgbColor = explode("-", $rgbColor);
return $rgbColor;
}
else { // found a - in the color string; is in rgb form; return
$rgbColor = $unformatedColor;
$rgbColor = explode("-", $rgbColor);
return $rbgColor;
}
}
function hextorgb($hex) {
if(strlen($hex) == 3) {
$hrcolor = hexdec(substr($hex, 0, 1)); //r
$hrcolor .= "-" . hexdec(substr($hex, 1, 1)); //g
$hrcolor .= "-" . hexdec(substr($hex, 2, 1)); //b
}
else if(strlen($hex) == 6) {
$hrcolor = hexdec(substr($hex, 0, 2)); //r
$hrcolor .= "-" . hexdec(substr($hex, 2, 2)); //g
$hrcolor .= "-" . hexdec(substr($hex, 4, 2)); //b
}
return $hrcolor;
}