PHP convert_cyr_string()関数
例
文字列をある文字セットから別の文字セットに変換します。
<?php
$str = "Hello world! æøå";
echo $str . "<br>";
echo convert_cyr_string($str,'w','a');
?>
定義と使用法
convert_cyr_string()関数は、文字列を1つのキリル文字セットから別の文字セットに変換します。
サポートされているキリル文字セットは次のとおりです。
- k-koi8-r
- w-windows-1251
- i-iso8859-5
- a-x-cp866
- d-x-cp866
- m-x-mac-キリル文字
注:この関数はバイナリセーフです。
構文
convert_cyr_string(string,from,to)
パラメータ値
Parameter | Description |
---|---|
string | Required. The string to convert |
from | Required. A character that specifies what Cyrillic character-set to convert from |
to | Required. A character that specifies what Cyrillic character-set to convert to |
技術的な詳細
戻り値: | 変換された文字列を返します |
---|---|
PHPバージョン: | 4歳以上 |
❮PHP文字列リファレンス