Q:

Convert from utf-8 hex code to character in PHP

I have the hex code c2ae, how to I convert this to the UTF-8 character: ®. I need a generic and SIMPLE solution for any hex code.
Update: this should work for any utf-8 hex code like d0a6

A:

function hexStringToString($hex) {
    return pack('H*', $hex);
}

