convert_cyr_string – PHP String Functions

Syntax :

convert_cyr_string (string, from, to);

Description :

convert_cyr_string() function will converts a string from one Cyrillic character set to another.


Parameter :

  • string – This is Required parameter. This is string which needs to be converted.
  • from – This is Required parameter. A character which specifies from which Cyrillic character-set to convert from.
  • to – This is Required parameter. A character which specifies in which Cyrillic character set to convert it.

Supported characters 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.

Output :

This will return the converted string.


convert_cyr_string() – PHP Functions Example 1 :
<?php
$strExample = 'Hello from Tutorialmines !!'; 
echo $strExample.'<br>'; 
echo convert_cyr_string($strExample, 'w', 'k'); 
?>

In above example ,We have a string. Now this function will convert this string from windows-1251 to koi8-r. Below will be the output of above example.

Hello from Tutorialmines !!
Hello from Tutorialmines !!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *