RGBcolour is an array as the var_dump shows, but then you can get the rgb color again with a sprintf:
$charitycolour1 = '#ff3300';
$RGBcolour = list($r, $g, $b) = sscanf($charitycolour1, "#%02x%02x%02x");
var_dump($RGBcolour);
$RGBcolour = sprintf("#%02x%02x%02x", $r, $g, $b);
echo 'RGBcolour: '.$RGBcolour;
outputs
array(3) {
[0]=>
int(255)
[1]=>
int(51)
[2]=>
int(0)
}
RGBcolour: #ff3300
If you want the RGB as 255,51,0 you can use join:
$charitycolour1 = '#ff3300';
$RGBarray = sscanf($charitycolour1, "#%02x%02x%02x");
$RGBcolour = join(',', $RGBarray);
echo 'RGBcolour: '.$RGBcolour;
This outputs: RGBcolour: 255,51,0
And if later on you want the hexa value again from that 255,51,0 value:
$RGBcolour = '255,51,0';
$RGBarray = explode(',', $RGBcolour);
$hexaColour = sprintf("#%02x%02x%02x", $RGBarray[0], $RGBarray[1], $RGBarray[2]);
echo 'Hexa Colour: '.$hexaColour;
that outputs: Hexa Colour: #ff3300
$RGBcolouris an array. Tryvar_dump($RBGcolour);to see what it contains.$RGBcolor = list($r, $g, $b) = split(",", "55,55,55").$charitycolour1after all. What have you tried to spot the problem in your real code?