Home >php教程 >php手册 >php简单的获得汉字的第一个拼音字母

php简单的获得汉字的第一个拼音字母

WBOY
WBOYOriginal
2016-06-06 20:12:521401browse

php简单的获得汉字的第一个拼音字母的函数: ?phpfunction getFirstChar($string) {$firstCharOrd = ord(strtoupper($string{0}));if (($firstCharOrd = 65 $firstCharOrd = 91) || ($firstCharOrd = 48 $firstCharOrd = 57))return strtoupper($string{0});

php简单的获得汉字的第一个拼音字母的函数:

<?php function getFirstChar($string) {
$firstCharOrd = ord(strtoupper($string{0}));
if (($firstCharOrd >= 65 && $firstCharOrd = 48 && $firstCharOrd =- 20319 && $asc =- 20283 && $asc =- 19775 && $asc =- 19218 && $asc =- 18710 && $asc =- 18526 && $asc =- 18239 && $asc =- 17922 && $asc =- 17417 && $asc =- 16474 && $asc =- 16212 && $asc =- 15640 && $asc =- 15165 && $asc =- 14922 && $asc =- 14914 && $asc =- 14630 && $asc =- 14149 && $asc =- 14090 && $asc =- 13318 && $asc =- 12838 && $asc =- 12556 && $asc =- 11847 && $asc =- 11055 && $asc 
  • 相关:ord() 函数返回字符串第一个字符的 ASCII 值。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn