PHP Classes


Recommend this page to a friend!
  Classes of Peter Kahl   Character Set From String   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Character Set From String
Identify predominant character set in a string
Author: By
Last change: PHP 7.4 compatibility, cleanup
Date: 3 years ago
Size: 2,591 bytes


Class file image Download

Charset From String

Downloads Download per Month License If this project has business value for you then don't hesitate to support me with a small donation.

Identifies predominant script (charset, language) in a string. This library is capable of identifying:

<pre> Arabic Armenian Bengali Burmese CJK Cyrillic Devanagari Georgian Greek Gujarati Hebrew Japanese Khmer Korean Lao Latin Malayalam Sinhala Tamil Thai Tibetan </pre>


use peterkahl\CharsetFromString\CharsetFromString;

echo CharsetFromString::getCharset('????? ????? ?? ???????')."\n"; # ARABIC

echo CharsetFromString::getCharset('????? ????? ?? ????-??')."\n"; # HEBREW

echo CharsetFromString::getCharset('??? ?????? ?????? ??????, ??? ??? ?? ?????.')."\n"; # CYRILLIC

echo CharsetFromString::getCharset('Lex iniusta non est lex.')."\n"; # LATIN

echo CharsetFromString::getCharset('??? ??? ?? ??? ??? ???? ??.')."\n"; # KOREAN

echo CharsetFromString::getCharset('??????????????')."\n"; # JAPANESE

echo CharsetFromString::getCharset('??????????')."\n"; # CJK

echo CharsetFromString::getCharset('??????????????? ??????????????')."\n"; # THAI

echo CharsetFromString::getCharset('????????????????????????????????????? ????')."\n"; # LAO

echo CharsetFromString::getCharset('?????????????????????????????????????????????')."\n"; # KHMER

echo CharsetFromString::getCharset('???????????????????????????????')."\n"; # TIBETAN

echo CharsetFromString::getCharset('? ????? ???????? ??? ???????? ?????? ????, ???? ???????? ???? ??? ??????.')."\n"; # GREEK