PHP code example of code-lives / alphabet

1. Go to this page and download the library: Download code-lives/alphabet library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

code-lives / alphabet example snippets



$PinYin = new \PinYin\PinYin();



$PinYin->convertPinyin("中国人");

输出 zhongguoren



$PinYin->convertPinyinList("中国人");

输出
Array
(
    [0] => zhong_guo_ren
)



$PinYin->convertInitalPinyin("中国人");

输出 zgr



$PinYin->convertInitalPinyinList("中国人");

输出 
Array
(
    [0] => zgr
)



$PinYin->convertAllPinyinList('中国人', '_');

输出 
Array
(
    [full] => Array
        (
            [0] => zhong_guo_ren
        )
    [inital] => Array
        (
            [0] => z_g_r
        )
)