PHP convert_uuencode() Function
Topic: PHP String ReferencePrev|Next
Description
The convert_uuencode()
function encodes a string using the uuencode algorithm.
The following table summarizes the technical details of this function.
Return Value: | Returns the uuencoded data. |
---|---|
Version: | PHP 5+ |
Syntax
The basic syntax of the convert_uuencode()
function is given with:
The following example shows the convert_uuencode()
function in action.
Example
Run this code »<?php
// Sample string
$str = "Hello World!";
// Uuencoding the string
echo convert_uuencode($str);
?>
Note: Uuencode translates all strings (including binary data) into printable characters, making them safe for network transmissions, such as emails. Uuencoded data is about 35% larger than the original. Also, to recreate the original string use the convert_uudecode()
function.
Parameters
The convert_uuencode()
function accepts the following parameter.
Parameter | Description |
---|---|
string | Required. Specifies the string to be encoded. |
More Examples
Here're some more examples showing how convert_uuencode()
function actually works:
In the following example a string will be first uuencoded then decoded.
Example
Run this code »<?php
// Sample string
$str = "Alice in Wonderland";
// Uuencoding the string
$encoded_str = convert_uuencode($str);
echo $encoded_str . "<br>";
// Decoding the string
$decoded_str = convert_uuencode($encoded_str);
echo $decoded_str;
?>