note 109724 modified in function.ord by danbrown

From: 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.&#13;&#10;&#13;&#10;&#60;?php&#13;&#10;mb_internal_encoding(&#34;UTF-8&#34;);&#13;&#10;$string = &#39;↗Զ&#39;;&#13;&#10;$char = mb_substr($string, 0, 1);&#13;&#10;var_dump(bin2hex($char)); //hex&#13;&#10;var_dump(hexdec(bin2hex($char))); //decimal&#13;&#10;?&#62;&#13;&#10;&#13;&#10;returns:&#13;&#10;&#13;&#10;string(6) &#34;e28697&#34;&#13;&#10;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

« previous php.notes (#190383) next »