How to use convert cyr string in PHP

In this article, I will explain how the convert_cyr_string() function can be used in PHP.
  • 2114

convert_cyr_string() function in PHP

  • The convert_cyr_string() function is used to convert a string from one Cyrillic character-set to another.
  • In  convert_cyr_string() function, supported Cyrillic character-sets are:
    • k - it is represent koi8-r

    • w - it is representwindows-1251

    • i - it is represent iso8859-5

    • a - it is represent x-cp866

    • d - it is represent x-cp866

    • m - it is represent x-mac-cyrillic

Syntax

convert_cyr_string(string,from,to)

Parameter

  • string string is required parameter. string is determine string to convert.
  • from from is required parameter. it is source Cyrillic character set.
  • to to is required parameter. it is destination Cyrillic character set.

Example

The following example show to how the convert_cyr_string() function can be used in PHP.

<html>

<body>

<h3 style="color: brown;">convert_cyr_string() function example in PHP</h3>

   <?php

    $string = 'Welcome to C-sharpcorner..';

    echo $string.'<br>';

    echo convert_cyr_string($string, 'w', 'k');

    ?>

</body>

</html>

 

Output

convertcyrstringphp.jpg
You may also want to read these related articles here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.