PHP convert_cyr_string() 函数

实例

把字符串由一种字符集转换成另一种:

<?php
$str = "Hello world! ???";
echo $str . "<br>";
echo convert_cyr_string($str,'w','a');
?>

定义和用法

convert_cyr_string() 函数把字符串由一种 Cyrillic 字符集转换成另一种。

被支持的 Cyrillic 字符集是:

  • k - koi8-r

  • w - windows-1251

  • i - iso8859-5

  • a - x-cp866

  • d - x-cp866

  • m - x-mac-cyrillic

注释:该函数是二进制安全的。

语法

convert_cyr_string(string,from,to)
参数描述
string必需。规定要转换的字符串。
from必需。一个规定了源 Cyrillic 字符集的字符。
to必需。一个规定了目标 Cyrillic 字符集的字符。

技术细节

返回值:返回已转换的字符串。
PHP 版本:4+