PHP convert_cyr_string() Function
In this chapter you will learn:
- Definition for PHP convert_cyr_string() Function
- Syntax for PHP convert_cyr_string() Function
- Parameter for PHP convert_cyr_string() Function
- Supported Cyrillic character-sets
- Return for PHP convert_cyr_string() Function
- Example - Convert a string from one character-set to another
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/*j a va 2s. c om*/
$str = "Hello world from java2s.com!";
echo $str . "\n";
echo convert_cyr_string($str,'w','a');
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP convert_uudecode() Function
- Syntax for PHP convert_uudecode() Function
- Parameter for PHP convert_uudecode() Function
- Return for PHP convert_uudecode() Function
- Example - Encode a string and then decode it
Home » PHP Tutorial » PHP String Functions