src/Pinyin.php
protected function romanize($string, $option = \PINYIN_DEFAULT)
    {
        $string = $this->prepare($string, $option);

        $dictLoader = $this->getLoader();

        if ($this->hasOption($option, \PINYIN_NAME)) {
            $string = $this->convertSurname($string, $dictLoader);
        }

        $dictLoader->map(function ($dictionary) use (&$string) {
            $string = strtr($string, $dictionary);
        });

        return $string;
    }
protected function romanize($string, $option = \PINYIN_DEFAULT)
    {
        $string = $this->prepare($string, $option);

        $dictLoader = $this->getLoader();

        if ($this->hasOption($option, \PINYIN_NAME)) {
            $string = $this->convertSurname($string, $dictLoader);
        }

        $dictLoader->map(function ($dictionary) use (&$string) {
            $string = strtr($string, $dictionary);
        });

        return $string;
    }
protected function romanize ( $ string , $ option = \ PINYIN_DEFAULT ) { $ string = $ this -> prepare ( $ string , $ option ) ; $ dictLoader = $ this -> getLoader ( ) ; if ( $ this -> hasOption ( $ option , \ PINYIN_NAME ) ) { $ string = $ this -> convertSurname ( $ string , $ dictLoader ) ; } $ dictLoader -> map ( function ( $ dictionary ) use ( & $ string ) { $ string = strtr ( $ string , $ dictionary ) ; } ) ; return $ string ; }
Convert Chinese to pinyin.

@param string $string
@param int    $option

@return string
Convert Chinese to pinyin .