<?php /** * Created by PhpStorm. * User: jifei * Date: 15/6/25 * Time: 下午2:26 */ class Pinyin { //中文字符串 private static $string = ''; //拼音 private static $pinyin = ''; private static $encoding = 'UTF-8'; //短拼音 private static $short_pinyin = ''; //单个汉字拼音的字典 private static $dic = array(
The native only conversion function is whether to return the first letter.
Extended support
1. Return format [all: full pinyin|first: initial letter|one: only the first letter of the first character]
2. Placeholder for unrecognized character replacement (original version Hard-coded is _ )
3. Allowed regular control of non-Chinese characters (the original hard-coded 0-9a-zA-Z, spaces are not supported)
is used by his pinyin. php ~ 206KB The UTF8 font library is only 106K after compression and expansion.
Of course, the performance is also close to his. In the 10,000 stress test, his 2.4s, after expansion, 2.8s, the loss is only 0.4s, so it can be ignored.
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article
11Jul2016
PHP method to convert Chinese characters into pinyin,
13Dec2024
Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...
28Oct2024
Suppression of Tensorflow Debugging OutputTensorflow prints extensive information about loaded libraries, found devices, and other debugging data...
03Jan2025
Overflow: Hidden and Expansion of HeightjQuery distinguishes itself from other JavaScript libraries through its cross-platform compatibility and...
30Oct2024
Native Java Image Processing Libraries for High-Quality ResultsAs you have encountered limitations with ImageMagick and JAI, let's explore other...
27Dec2024
Executing Command Line Binaries in Node.jsExecuting third-party binaries is an essential task when porting CLI libraries from other languages to...
Hot Tools
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images