Last active
August 13, 2020 14:59
-
-
Save ve3/90d9871dc87d5408f6edd7b36cff75e1 to your computer and use it in GitHub Desktop.
PHP: list Thai characters in array. แสดงอักขระภาษาไทยเป็น array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo '<meta charset="utf-8">' . PHP_EOL; | |
/*for ($i = 0; $i <= 255; $i++) { | |
$string = chr($i); | |
echo $i . ' => '; | |
echo iconv('tis-620', 'utf-8//IGNORE', $string); | |
//echo ' '; | |
echo '<br>' . PHP_EOL; | |
}*/ | |
// thai characters (for chr() function) are 161-218, 223-251 | |
echo '['; | |
// https://everythingfonts.com/unicode/thai | |
for ($i = 3585; $i <= 3642; $i++) { | |
echo '\''; | |
echo '&#' . $i . ';'; | |
echo '\''; | |
echo ', ' . PHP_EOL; | |
} | |
for ($i = 3647; $i <= 3675; $i++) { | |
echo '\''; | |
echo '&#' . $i . ';'; | |
echo '\''; | |
if ($i < 3675) { | |
echo ', ' . PHP_EOL; | |
} | |
} | |
echo ']'; | |
// result | |
// ['ก', 'ข', 'ฃ', 'ค', 'ฅ', 'ฆ', 'ง', 'จ', 'ฉ', 'ช', 'ซ', 'ฌ', 'ญ', 'ฎ', 'ฏ', 'ฐ', 'ฑ', 'ฒ', 'ณ', 'ด', 'ต', 'ถ', 'ท', 'ธ', 'น', 'บ', 'ป', 'ผ', 'ฝ', 'พ', 'ฟ', 'ภ', 'ม', 'ย', 'ร', 'ฤ', 'ล', 'ฦ', 'ว', 'ศ', 'ษ', 'ส', 'ห', 'ฬ', 'อ', 'ฮ', 'ฯ', 'ะ', 'ั', 'า', 'ำ', 'ิ', 'ี', 'ึ', 'ื', 'ุ', 'ู', 'ฺ', '฿', 'เ', 'แ', 'โ', 'ใ', 'ไ', 'ๅ', 'ๆ', '็', '่', '้', '๊', '๋', '์', 'ํ', '๎', '๏', '๐', '๑', '๒', '๓', '๔', '๕', '๖', '๗', '๘', '๙', '๚', '๛']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment