Thursday, 25 September 2014

convert_cyr_string in PHP

PHP convert_cyr_string() function is utilized to changes over a string from one Cyrillic character set to a different one.
The Cyrillic character-sets supported by this function are:
  • k - koi8-r
  • w - windows-1251
  • i - iso8859-5
  • a - x-cp866
  • d - x-cp866
  • m - x-mac-cyrillic

Syntax:

convert_cyr_string(string,from,to)
 
Parameters Description:
string : Required. The input string.
from : Required. The source Cyrillic character set, as a single character
to : Required. The target Cyrillic character set, as a single character.
Note: PHP convert_cyr_string() function is binary-safe.

Example:

<?php 
$str = "Good Morning! æøå";
echo $str . "<br />";
echo convert_cyr_string($str,'w','a');
?>

Output  will be:

Good Morning! æøå
Good Morning! ¦è¥

0 comments:

Post a Comment