help regarding equivalent function in javascript and PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kavyareddy
Forum Newbie
Posts: 1
Joined: Fri Feb 10, 2006 4:25 am

help regarding equivalent function in javascript and PHP

Post 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.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post 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");
Post Reply