note 109724 modified in function.ord by danbrown
| From: | danbrown@php.net | Date: | Fri, 31 Aug 2012 16:31:58 +0000 |
| Subject: | note 109724 modified in function.ord by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190383@lists.php.net to get a copy of this message | ||
Since this function is not utf-8/unicode ready, you can use following code to get the hex or dec
representation of a
character. <?php mb_internal_encoding("UTF-8"); $string
= 'âÔ¶'; $char = mb_substr($string, 0,
1); var_dump(bin2hex($char));
//hex var_dump(hexdec(bin2hex($char)));
//decimal ?> returns: string(6)
"e28697" int(14845591)
--was--
Since this function is not utf-8/unicode ready, you can use following code to get the hex or dec
representation of a character.
<?php
mb_internal_encoding("UTF-8");
$string = 'âÔ¶';
$char = mb_substr($string, 0, 1);
var_dump(bin2hex($char)); //hex
var_dump(hexdec(bin2hex($char))); //decimal
?>
returns:
string(6) "e28697"
int(14845591)
countercheck:
http://www.utf8-chartable.de/unicode-utf8-table.pl?start=8592
http://php.net/manual/en/function.ord.php