php emoji utf8转unicode
/*** Translates a sequence of UTF-8 bytes to their equivalent unicode code points.
* Each code point is prefixed with "\u".
*
* @param string $utf8
*
* @return string
*/function utf8_to_unicode($utf8) {
$i = 0;
$l = strlen($utf8);
$out = '';
while ($i < $l) {
if ((ord($utf8[$i]) & 0x80) === 0x00) {
// 0xxxxxxx
$n = ord($utf8[$i++]);
} elseif ((ord($utf8[$i]) & 0xE0) === 0xC0) {
// 110xxxxx 10xxxxxx
$n =
((ord($utf8[$i++]) & 0x1F)
页:
[1]