note 76467 added to function.preg-replace
| From: | 131 dot php at cloudyks dot org | Date: | Tue, 17 Jul 2007 11:37:35 +0000 |
| Subject: | note 76467 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128645@lists.php.net to get a copy of this message | ||
Based on previous comment, i suggest
( this function already exist in php 6 )
function unicode_decode($str){
return preg_replace(
'#\\\u([0-9a-f]{4})#e',
"unicode_value('\\1')",
$str);
}
function unicode_value($code) {
$value=hexdec($code);
if($value<0x0080)
return chr($value);
elseif($value<0x0800)
return chr((($value&0x07c0)>>6)|0xc0)
.chr(($value&0x3f)|0x80);
else
return chr((($value&0xf000)>>12)|0xe0)
.chr((($value&0x0fc0)>>6)|0x80)
.chr(($value&0x3f)|0x80);
}
----
Server IP: 217.174.196.197
Probable Submitter: 82.236.206.18
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/76467
Del: integrated -- https://master.php.net/note/delete/76467/integrated
Del: useless -- https://master.php.net/note/delete/76467/useless
Del: bad code -- https://master.php.net/note/delete/76467/bad+code
Del: spam -- https://master.php.net/note/delete/76467/spam
Del: non-english -- https://master.php.net/note/delete/76467/non-english
Del: in docs -- https://master.php.net/note/delete/76467/in+docs
Del: other reasons-- https://master.php.net/note/delete/76467
Reject -- https://master.php.net/note/reject/76467
Search -- https://master.php.net/manage/user-notes.php