PHP convert_uuencode() Function
PHP convert_uuencode() Function
The convert_uuencode() function in PHP is used to encode a string and returns the uuencoded data.
Syntax
convert_uuencode ( string $data )
Parameter
data(required)- This parameter represents the data to be encoded.
Return
This function returns the uuencoded data or FALSE on failure.
Example 1
<?php // initializing the string $str = "Hello World ! "; echo "Original String: ".$str; //after encoding the string echo "After using the convert_uuencode() function..." echo "\nNew String: ".convert_uuencode($str); ?>
Output
Original String: Hello World ! New String: .2&5L;&\@5V]R;&0@(2``
Example 2
<?php // initializing the string $str = "Tutorial and Example "; echo "Original String: ".$str; echo "\nAfter convert_uuencode() function..."; //encoding the string echo "\nNew String: ".convert_uuencode($str); ?>
Output
Original String: =5V5L8V]M92!T;R!4=71O<FEA;&%N9$5X86UP;&4` After convert_uudecode() function... New String: Welcome to TutorialandExample
Example 3
<?php // Decode the string $str1 ="55V5L8V]M92!T;R!02%`@5V]R;&0A"; echo "Encoded string:".$str1; echo "\nAfter using the 'convert_uudecode()' function... "; $EncodedStr = convert_uudecode($str1); echo "\nNew String:".$EncodedStr . "\n\n"; //encode the string $str2 = "Welcome to PHP World!"; echo "Decoded string:".$str2; echo "\nAfter using 'convert_uuencode()' function..."; $dencodeStr = convert_uuencode($str2); echo "\nNew String: ".$dencodeStr; ?>
Output
Encoded string:55V5L8V]M92!T;R!02%`@5V]R;&0A After using the 'convert_uudecode()' function... New String:Welcome to PHP World! Decoded string:Welcome to PHP World! After using 'convert_uuencode()' function... New String: 55V5L8V]M92!T;R!02%`@5V]R;&0A
Example 4
<?php // initializing the string $str = "766&&@#sg' "; echo "Original String: ".$str; echo "\nAfter convert_uuencode() function..."; //encoding the string echo "\nNew String: ".convert_uuencode($str); ?>
Output
Original String: 766&&@#sg' After convert_uuencode() function... New String: +-S8V)B9`(W-G)R``