Difference Between Uuencode and Uudecode Function in PHP

Introduction

In this article I explain the difference between Uuencode and Uudecode functions in PHP. Both functions are string functions and are very useful to encode and decode a string. The convert_uuencode() function Uuencodes a string. The convert_Uuencode() function translates all strings into printable characters, making them safe for network transmissions. Uuencoded data is about 35% larger than the original.

Syntax

convert_uuencode(string $data);

 

Parameter Description
data The data to be encoded.

This function returns the encoded data.

Example

<?php

$some_string = "My name is Vinod Kumar";

echo convert_uuencode($some_string);

?>

Output

image2.jpg

Syntax

convert_uudecode(string $data);

 

Parameter  
data Pass the data uuencoded form.

This function returns the decoded data as a string.

Example

<?php

/* Can you imagine what this will print? :) */

$data="+22!L;W9E(%!(4\"$`\n`";

$data2="!(``` ` ";

$data3="+5FEN;V0@2W5M87(` ` ";

echo convert_uudecode($data);

echo convert_uudecode($data2);

echo convert_uudecode($data3);

?>

Output

image1.jpg


Similar Articles