• PHP Video Tutorials

PHP - imap_utf8() Function



PHP−IMAP functions helps you to access email accounts, IMAP stands for Internet Mail Access Protocol using these functions you can also work with NNTP, POP3 protocols and local mailbox access methods.

The imap_utf8() function accepts a MIME encoded string as a parameter and decodes it to UTF-8.

Syntax

imap_utf8($txt);

Parameters

Sr.No Parameter & Description
1

txt (Mandatory)

This is a string value representing MIME encoding string.

Return Values

This function returns a string value holding UTF-8 value of the given string.

PHP Version

This function was first introduced in PHP Version 4 and works in all the later versions.

Example

Following example demonstrates the usage of the imap_utf8() function.

<html>
   <body>
      <?php
         $mime_encoded = 'example: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=';
         $res = imap_utf8($mime_encoded);
         print($res);
         print("<br>");
		
         $mime_encoded = 'test =?ISO-8859-1?Q?Schl=FCter?=';
         $res = imap_utf8($mime_encoded);
         print($res);
      ?>
   </body>
</html>

Output

This will generate the following output −

example: Prüfung Prüfung
test Schlüter
php_function_reference.htm
Advertisements