preg_replace function
Posted: Fri Nov 28, 2003 2:20 am
Can anyone help me with this?
I have an string and it has strings like this:
{i:xxxx} where xxxx is an hexadecimal number , I need to trasform this into something like this:
&#X; where X is the decimal conversion of xxxx
I am currently using something like this , but it does not work:
$string=preg_replace( "{i:([0-9A-F]{4})}",chr(38).chr(35).hexdec("$1").chr(59),$string);
for an string like this {i:F991}, it returns :
{} and I want to return 撚
63889 is the hexadecimal conversion of F981
I really appreciate any help :lol:
I have an string and it has strings like this:
{i:xxxx} where xxxx is an hexadecimal number , I need to trasform this into something like this:
&#X; where X is the decimal conversion of xxxx
I am currently using something like this , but it does not work:
$string=preg_replace( "{i:([0-9A-F]{4})}",chr(38).chr(35).hexdec("$1").chr(59),$string);
for an string like this {i:F991}, it returns :
{} and I want to return 撚
63889 is the hexadecimal conversion of F981
I really appreciate any help :lol: