PHP gets the first letter of Chinese pinyin
Copy CodeThe code is as follows:
function Getinitial ($STR)
{
$asc =ord (substr ($str, 0, 1));
if ($ASC {
if ($asc >=48 && $asc Return ' 1 '; Digital
}elseif ($asc >=65 && $asc return Chr ($ASC);
First, the same operation, Peid check shell: VB program, no shell, OK, pay attention to the function of VB can, here is recommended a microblog, summed up in the reverse commonly used in VB functionThe common function of reverse disassembly of VB
In order to do the database Pinyin keyword search Think of the product name generation Pinyin as the key word into the database, so the Internet to collect information to complete a such thing
/**
* Chinese Pinyin Conversion class
* @author
The first letter of Chinese characters in php to pinyin. PHP obtains the first letter of pinyin.
After running the program, some characters in the string cannot be converted. If you enter these words separately, you can directly convert them to read
To get the first letter of the method there are many, this we generally want to divide the Chinese characters and then converted to pinyin, and then use SUBSTR to take the first letter, below I found online two instances, different people together
Example 1The main functions are: clear functions, easy to modify, maintain, and expand; English strings: unchanged return (including numbers); Chinese Strings: return the first character of pinyin; Chinese-English string: returns the first and
PHP get Pinyin First letter
After the program runs, it is found that some text in the string cannot be converted. If you enter these words individually, you can read and remove the phonetic opening letters directly by converting them.
It doesn't
Let's take a look at how to get the first letter of a single Chinese character. See the following function. It supports GBK and UTF8 encoding: The code is as follows:Copy code Function getfirstchar ($ s0 ){$ Fchar = ord ($ s0 {0 });If ($ fchar> =
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.