Actually, there isn't really any difference in the internal representation of data.
An integer is an integer... it may be output in decimal form, or hexadecimal form...
And actually, PHP doesn't keep track whether a value is a string or what:
$string = "2";
$string = $string + 2;
// will output 4
echo $string;
that said, try:
integer hexdec(string hexadecimal_number)
The hexdec function converts a string that represents a hexadecimal number into an integer. Preceeding the number with "0x" is optional.
Isn't that what you want?