PHP Function Reference

PHP convert_uuencode() Function



The PHP convert_uuencode() function encodes a string using the uuencode algorithm. Uuencode translates all strings (including binary data) into printable characters, making them safe for network transmissions. Uuencoded data is about 35% larger than the original.

Syntax

convert_uuencode(string)

Parameters

string Required. Specify the data to be encoded.

Return Value

Returns the uuencoded data.

Example:

The example below shows the usage of convert_uuencode() function.

<?php
$str = "Programming is fun";

$uuencode_str = convert_uuencode($str);

echo "The string is: $str \n";
echo "Encoded string is: $uuencode_str \n";
?>

The output of the above code will be:

The string is: Programming is fun 
Encoded string is: 24')O9W)A;6UI;F<@:7,@9G5N`  

Example:

Consider one more example which shows how a string is encoded and decoded.

<?php
$str1 = "Programming is fun";
$uuencode_str1 = convert_uuencode($str1);

echo "The string is: $str1 \n";
echo "Encoded string is: $uuencode_str1 \n";

$str2 = "24')O9W)A;6UI;F<@:7,@9G5N`";
$uudecode_str2 = convert_uudecode($str2);

echo "The string is: $str2 \n";
echo "Decoded string is: $uudecode_str2 \n";
?>

The output of the above code will be:

The string is: Programming is fun 
Encoded string is: 24')O9W)A;6UI;F<@:7,@9G5N`

The string is: 24')O9W)A;6UI;F<@:7,@9G5N` 
Decoded string is: Programming is fun 

❮ PHP String Reference