Here's how to use bitwise operations for RGB2hex conversion. This function returns hexadesimal rgb value just like one submitted by gurke@bigfoot.com above.
function hexColor($color) {
return dechex(($color[0]<<16)|($color[1]<<8)|$color[2]);
}
example:
$col[0] = 25;
$col[1] = 255;
$col[2] = 55;
print hexColor($col);