Converting a Unicode code to related charachter
| From: | Ali Asghar Toraby Parizy | Date: | Sun, 18 Dec 2011 09:33:04 +0000 |
| Subject: | Converting a Unicode code to related charachter | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-316058@lists.php.net to get a copy of this message | ||
Hi.
As I was writing a php code last week, I struggled with a function that was
supposed to convert Unicode code to a character. At last I wrote this
function:
function unicodeToChr($param) {
$a =json_decode('{"t":"'.$param.'"}');
return $a->t;
}
In this function the $param should be something like '\u0627'. I want to
know if it's acceptable to use this function? Does exist any better
solution to do that?
Thanks.