convert_cyr_string() function in PHP


The convert_cyr_string() function is used to convert from one Cyrillic character set to another.

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

Syntax

convert_cyr_string(str, from, to)

Parameters

  • str − String to format

  • from − The source Cyrillic character set, as a single character.

  • to − The destination Cyrillic character set, as a single character.

Return

The convert_cyr_string() function returns the converted string.

The following is an example −

Example

Live Demo

<?php
   $s = "Welcome to the website! æøå";
   echo $s . "<br>";
   echo convert_cyr_string($str,'w','a'); 
?>

The following is the output −

Output

Welcome to the website! æøå
Welcome to the website! ¦è¥

Updated on: 30-Jul-2019

36 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements