Page 1 of 1

help regarding equivalent function in javascript and PHP

Posted: Fri Feb 10, 2006 5:01 am
by kavyareddy
hi frnds iam new to this group
i had one doubt
there is a function in Javascript charCodeAt().toString() which converts any language from hexformat to String
hence i require equivalent function to the above functio in PHP
the functio in PHP also should convert any language from hexaformat to strings.

Posted: Fri Feb 10, 2006 5:10 am
by JayBird
i think maybe something like this

Code: Select all

function hex2str($hex) {
for( $i=0 ; $i < strlen($hex); $i  = 2){
	$str .= chr(hexdec(substr($hex, $i, 2)));
  }
return $str ;
}

echo hex2str("61626áb80C7BA78797a");