I want to remove the pound sign (#) from a hex string if it exists.
I tried the following code...
$str = "#F16AD3";
//Match the pound sign in the beginning
if (preg_match("/^\#/", $str)) {
//If it's there, remove it
preg_replace('/^\#/', '', $str);
};
print $str;
..but it didn't work. It prints out "#F16AD3".
Any ideas?