note 108829 added to function.range

From: Date: Mon, 28 May 2012 22:13:36 +0000
Subject: note 108829 added to function.range
Groups: php.notes 
Request: Send a blank email to php-notes+get-188268@lists.php.net to get a copy of this message
a replacement for UTF8/mb needs found at http://stackoverflow.com/questions/7860270/php-string-function-with-non-english-languages // Returns the UTF-8 character with code point $intval function unichr($intval) { return mb_convert_encoding(pack('n', $intval), 'UTF-8', 'UTF-16BE'); } // Returns the code point for a UTF-8 character 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; } //With the above, you can now write: for($char = uniord('क'); $char <= uniord('म'); ++$char) { $alphabet[] = unichr($char); } print_r($alphabet); ---- Server IP: 69.147.83.197 Probable Submitter: 91.22.148.219 ---- Manual Page -- http://www.php.net/manual/en/function.range.php Edit -- https://master.php.net/note/edit/108829 Del: integrated -- https://master.php.net/note/delete/108829/integrated Del: useless -- https://master.php.net/note/delete/108829/useless Del: bad code -- https://master.php.net/note/delete/108829/bad+code Del: spam -- https://master.php.net/note/delete/108829/spam Del: non-english -- https://master.php.net/note/delete/108829/non-english Del: in docs -- https://master.php.net/note/delete/108829/in+docs Del: other reasons-- https://master.php.net/note/delete/108829 Reject -- https://master.php.net/note/reject/108829 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188268) next »