PHP - convert_cyr_string() Function



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

This function allows you to change the encoding of a string from one Cyrillic script to another, such as from KOI8-R to Windows-1251 or from UTF-8 to ISO-8859-5.

This function has been DEPRECATED as of PHP version 7.4.0, and REMOVED as of PHP version 8.0.0.

Syntax

Following is the syntax of the PHP convert_cyr_string() function −

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

Parameters

This function accepts three parameters, which are listed below −

  • str − The string needs to be converted.
  • from − It represents the source Cyrillic character set, as a single character.
  • to − It represents the target Cyrillic character set, as a single character.

Return Value

This function returns the converted string.

Example

The following program demonstrates the usage of the PHP convert_cyr_string() function −

<?php
   $str = "tutorials Point ";
   echo convert_cyr_string($str,'w','a'); 
?>

Output

After executing the above program, the following error will be occur because this function is "DEPRECATED" −

PHP Fatal error:  Uncaught Error: Call to undefined function convert_cyr_string() in C:\Apache24\htdocs\index.php:3
Stack trace:
#0 {main}
  thrown in C:\Apache24\htdocs\index.php on line 3
php_function_reference.htm
Advertisements