PHP convert_uuencode() Function

What is PHP convert_uuencode() Function?

If you want to encode a string (which may include binary data) into a printable text, use php convert_uuencode() function. UUEncoding  is Unix-to-Unix Encoding.

Why you use PHP convert_uuencode() Function?

Some systems like old email systems, text-only storage, logs files or plain-text files cannot handle raw binary data properly. So, you need to encode it into text so that you can safely transmit or store the data. For this reason, we need php convert_uuencode() function.

Syntax:

convert_uuencode(string)

Parameters:

The Function has 1 parameter which is required-

string (Required): it specifies the string to be encoded.

Return Values:

The function returns the uuencoded string.

Examples:

Example 1:

<?php
$string = "Hello World!";
echo "After uuencoding, \"$string\" becomes: " . convert_uuencode($string);
?>

Output:

After uuencoding, "Learn PHP" becomes: )3&5A




Notes on convert_uuencode() Function:

  • After encryption with this function the data volume increases by 35%.
  • A complete uuencode file requires begin or end line. This function doesn’t create this. It only encoded data.

PHP Version Support:

PHP 5, PHP 7, PHP 8

Summary: PHP convert_uuencode() Function

convert_uuencode() function is one of the built-in string functions. Use this function to encode a string into printable text.

Reference:

https://www.php.net/manual/en/function.convert-uuencode.php