欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php获取中文的拼音代码_PHP教程

程序员文章站 2024-01-01 11:04:04
...

php获取中文的拼音代码

获取中文的拼音代码


 160)
			{
				$_Q = ord(substr($chinese, ++$i, 1));
				$_P = $_P * 256 + $_Q - 65536;
			}
			$result .= ($ucfirst ? ucfirst(self::_pinyin($_P, $data)) : self::_pinyin($_P, $data));
		}

		return preg_replace("/[^a-z0-9]*/i", '', $result);
	}

	private static function _pinyin($num, $data) {
		if ($num > 0 && $num  -10247)
			return '';
		else
		{
			foreach ($data as $k => $v)
			{
				if ($v > 6);
			$string .= chr(0x80 | $c & 0x3F);
		}
		elseif ($c > 12);
			$string .= chr(0x80 | $c >> 6 & 0x3F);
			$string .= chr(0x80 | $c & 0x3F);
		}
		elseif ($c > 18);
			$string .= chr(0x80 | $c >> 12 & 0x3F);
			$string .= chr(0x80 | $c >> 6 & 0x3F);
			$string .= chr(0x80 | $c & 0x3F);
		}

		return iconv('UTF-8', 'GB2312', $string);
	}

}

?> 


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/847856.htmlTechArticlephp获取中文的拼音代码 获取中文的拼音代码 160){$_Q = ord(substr($chinese, ++$i, 1));$_P = $_P * 256 + $_Q - 65536;}$result .= ($ucfirst ? ucfirst(self::_pinyin($_P...
相关标签: 拼音 代码

上一篇:

下一篇: