PHP convert_cyr_string() Function
Definition
The convert_cyr_string() function converts a string from one Cyrillic character-set to another.
Syntax
PHP convert_cyr_string() function has the following syntax.
convert_cyr_string(string,from,to)
Parameter
Parameter | Is Required | 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 |
Supported Cyrillic character-sets
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
This function is binary-safe.
Return
PHP convert_cyr_string() Function returns the converted string.
Example
Convert a string from one character-set to another:
<?php//from w w w.j a v a 2s . co m
$str = "Hello world from java2s.com!";
echo $str . "\n";
echo convert_cyr_string($str,'w','a');
?>
The code above generates the following result.