English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP convert_cyr_string() Function Usage and Example

    PHP String Character String Functions Manual

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

Syntax

string convert_cyr_string ( string $str , string $from , string $to )

Definition and Usage

 This function converts the given string from one Cyrillic character to another and returns the converted string.

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

Return Value

It returns the converted string.

Parameter

Serial NumberParameters and Description
1

str

The string to be converted

2

from

A single character, representing the source Cyrillic character set.

3

to

A single character, representing the target Cyrillic character set.

Online Example

Try the following example, converting a string from one character set to another

<?php
    //convert_cyr_string converts a string from one character set 'w' to another character set 'a'
    $str = \3codebox.com ";
    echo convert_cyr_string($str,'w','a');
    ?>
Test See‹/›

Output Result

www.oldtoolbag.com

PHP String Character String Functions Manual