PHP convert_cyr_string()Functions
Examples
Convert a string from one character set to another:
<?php
$str = "Hello world! æøå";
echo $str . "<br>";
echo convert_cyr_string($str,'w','a');
?>
$str = "Hello world! æøå";
echo $str . "<br>";
echo convert_cyr_string($str,'w','a');
?>
Run example »
Definition and Usage
The convert_cyr_string() function converts a string from one Cyrillic character set to another.
The supported Cyrillic character sets are:
- 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.
Syntax
convert_cyr_string(string,from,to)
| Parameters | Description |
|---|---|
| string | Required. Specifies the string to convert. |
| from | Required. A character that specifies the source Cyrillic character set. |
| to | Required. A character that specifies the target Cyrillic character set. |
Technical Details
| Return value: | Returns the converted string. |
|---|---|
| PHP Version: | 4+ |
PHP String Reference Manual Other Extensions