Latest web development tutorials

PHP convert_cyr_string () function

PHP String Reference PHP String Reference

Examples

String from one character set into another:

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

Running instance »

Definition and Usage

convert_cyr_string () function to a string from one Cyrillic character set into another.

Supported Cyrillic character set is:

  • k - koi8-r
  • w - windows-1251
  • i - iso8859-5
  • a - x-cp866
  • d - x-cp866
  • m - x-mac-cyrillic

Note: This function is binary safe.


grammar

convert_cyr_string( string,from,to )

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

technical details

return value: Returns the converted string.
PHP version: 4+


PHP String Reference PHP String Reference