note 42778 modified in function.ord by danbrown
| From: | danbrown@php.net | Date: | Tue, 11 Oct 2011 16:17:01 +0000 |
| Subject: | note 42778 modified in function.ord by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183810@lists.php.net to get a copy of this message | ||
I did not found a unicode/multibyte capable 'ord' function, so...
<?php
function uniord($u) {
$k = mb_convert_encoding($u, 'UCS-2LE', 'UTF-8');
$k1 = ord(substr($k, 0, 1));
$k2 = ord(substr($k, 1, 1));
return $k2 * 256 + $k1;
}
?>
--was--
I did not found a unicode/multibyte capable 'ord' function, so...
function uniord($u) {
$k = mb_convert_encoding($u, 'UCS-2LE', 'UTF-8');
$k1 = ord(substr($k, 0, 1));
$k2 = ord(substr($k, 1, 1));
return $k2 * 256 + $k1;
}
http://php.net/manual/en/function.ord.php