String Functions In PHP: PART 3

Introduction

In this article I describe the PHP string functions convert_cyr_string, convert_uudecode and convert_uuencode. To learn some other math functions, go to:

  1. String Functions in PHP: Part1
     
  2. String Functions in PHP:Part2

PHP convert_cyr_string() Function

The PHP convert_cyr_string function converts a string from one Cyrillic character set to another and returns a converted string.

The supported characters 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(string, from,to)

Parameters of the convert_cyr_string Function

The parameters of the convert_cyr_string function are:

Parameter Description
string It specifies the string to convert.
length It specifies Cyrillic character set, as a single character.
to It specifies what Cyrillic character-set to convert to.

Example

An example of the
convert_cyr_string function is:

<?php 

$string = 'Welcome at MCN Solution..'

echo $string.'<br>'

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

?>

Output

convert-cyr-string-function-in-php.jpg

PHP convert_uudecode() function

The convert_uudecode function is used to decode a uuencoded string.


Syntax

convert_uudecode(string)

Parameter in convert_uudecode Function

The parameter of the convert_uudecode function is:

Parameter Description
string It specifies the uuencoded string to decode.

Example

An example of the
convert_uudecode function is:

<?php

echo convert_uudecode("+22!L;W9E(%!(4\"$`\n`");

?>

Output

convert-uudecode -string-function-php.jpg 

PHP convert_uuencode() Function

The convert_uuencode function encodes a string using the uuencode algorithm.


Syntax

convert_uuencode(string)

Parameter in convert_uuencode Function

The parameter of the convert_uuencode function is:

Parameter Description
string It specifies the string to uuencode.

Example

An example of the
convert_uuencode function is:

<?php

echo convert_uuencode("Vinod");

?>

Output

convert-uuencode -string-in-php.jpg