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

ParameterIs RequiredDescription
stringRequired. The string to convert
fromRequired. A character that specifies what Cyrillic character-set to convert from
toRequired. 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.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions