WHAT exactly holds the integer???
i would use a 9 digit integer - 3 x 3 digits - and each 3 digit group stands for a value of each color (RG😎 - and each 3 digit group must be a number between 0 and 255 - ie -
$colRgb = "127233015";
the groups are: 127, 233, 015
then you pull them out with the substring() function:
you get 3 numbers as substrings...
$col[r] = substr($colRgb, 0, 3);
$col[g] = substr($colRgb, 2, 3);
$col[b] = substr($colRgb, 5, 3);
then you convert them into the hex code - check http://www.php.net/manual/en/function.dechex.php for that -
$col[r] = dechex($col[r]);
$col[g] = dechex($col[g]);
$col[b] = dechex($col[b]);
and then join the 3 hexadecimal values.
$colHex = "#" . "$col[r]" . "$col[g]" . "$col[b]";
the quick version of all the above would be:
$colHex = "#" . dechex(substr($colRgb, 0, 3)) . dechex(substr($colRgb, 2, 3)) . dechex(substr($colRgb, 5, 3));
that should give you the corresponding hex color value - which i am too lazy to convert for the example now...
finally:
print "<body bgcolor=\"" . "$colHex" . "\">";
should print the right code...
hope this helps - is what you wanted - and works ;-)