note 73697 deleted from function.preg-replace by danbrown
| From: | danbrown@php.net | Date: | Fri, 28 Nov 2008 19:53:21 +0000 |
| Subject: | note 73697 deleted from function.preg-replace by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147152@lists.php.net to get a copy of this message | ||
Note Submitter: mrozenoer at overstream dot net
----
I could not find a function to unescape javascript unicode escapes anywhere (e.g.,
"\u003c"=>"<").
<?php
function js_uni_decode($s) {
return preg_replace('/\\\u([0-9a-f]{4})/ie', "chr(hexdec('\\1'))",
$s);
}
echo js_uni_decode("\u003c");
?>