PHP imap_binary() Function Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report The imap_binary() function is an inbuilt function in PHP that is used to convert the 8-bit string into the base64 encoding. This function is used by some IMAP servers to represent mailbox names that contain non-ASCII characters or certain ASCII characters that are special in IMAP. Syntax: imap_binary(string $string) : string | falseParameters: This function accepts only one parameter which is described below. $string: This is the string parameter that contains the 8-bit string.Return Values: The imap_binary() function if successfully executed will return a base64 encoded string otherwise this function will return "false". Note: Before using this function check if this is available in your environment or not. If not, then type this command apt-get install php-imapReferences: How to Install imap extension in PHP on Windows?How to Install imap extension in PHP on Linux? Program 1: The following program demonstrates the imap_binary() function. PHP <?php $string = "geeksforgeeks"; $eightBitData = imap_binary($string); // Output the result echo "Original data: $string\n"; echo "Converted base64 data: $eightBitData\n"; ?> Output: Original data: geeksforgeeksConverted base64 data: Z2Vla3Nmb3JnZWVrcw==Program 2: The following program demonstrates the imap_binary() function. PHP <?php $utf7data1 = "&ZeVnLIqe-"; $utf7data2 = "&BfAEEAbABlAG4ALwA-"; // Check if the imap_binary() function exists if (function_exists("imap_binary")) { $eightBitData1 = imap_binary($utf7data1); $eightBitData2 = imap_binary($utf7data2); // Output the results echo "Original UTF-7 data 1: $utf7data1\n"; echo "Converted 8-bit data 1: $eightBitData1\n\n"; echo "Original UTF-7 data 2: $utf7data2\n"; echo "Converted 8-bit data 2: $eightBitData2\n"; } else { echo "imap_binary() function is not available" . " in this environment.\n"; } ?> Output: Original UTF-7 data 1: &ZeVnLIqe-Converted 8-bit data 1: JlplVm5MSXFlLQ==Original UTF-7 data 2: &BfAEEAbABlAG4ALwA-Converted 8-bit data 2: JkJmQUVFQWJBQmxBRzRBTHdBLQ==Reference: https://www.php.net/manual/en/function.imap-binary.php Comment More infoAdvertise with us Next Article PHP imap_binary() Function neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-IMAP Similar Reads PHP imap_base64() Function The imap_base64() function is an inbuilt function in PHP that is used to decode the base64 encoded text. Syntax: imap_base64(string $string)Parameters: This function accepts only one parameter which is described below. $string: This is the base64 string parameter that is going to be decoded.Return V 1 min read PHP | hash_final() Function The hash_final() function is an inbuilt function in PHP which is used to finalize an incremental hash and return the resulting digest. Syntax: hash_final( $context, $raw_output ) Parameters: This function accept two parameters as mention above and describe below. $context: This parameter is used to 1 min read PHP | gmp_clrbit() Function The gmp_clrbit() function is an in-built function in PHP which clears a bit of a GMP number (GNU Multiple Precision). The gmp_clrbit() function sets the bit at a specified index in a GMP number to 0. The index starts at zero from the least significant bit. Syntax : gmp_clrbit( $num, $index ) Paramet 2 min read PHP | gmp_and() Function The gmp_and() is an inbuilt function in PHP which is used to calculate the bitwise AND of two GMP numbers(GNU Multiple Precision : For large numbers). Syntax: gmp_and($num1, $num2) Parameters: This function accepts two GMP numbers, $num1, $num2 as mandatory parameters as shown in the above syntax. T 2 min read PHP | imagebmp() Function The imagebmp() function is an inbuilt function in PHP which is used to return the output or save a BMP version of the given image. Syntax: bool imagebmp( resource $image, mixed $to, bool $compressed ) Parameters: This function accept three parameters as mentioned above and described below: $image: I 1 min read PHP array() Function The array() function is an inbuilt function in PHP which is used to create an array. There are three types of array in PHP: Indexed array: The array which contains numeric index. Syntax: array( val1, val2, val3, ... ) Associative array: The array which contains name as keys. Syntax: array( key=>v 2 min read PHP decbin( ) Function While working with numbers, many times we need to convert the bases of number and one of the most frequent used conversion is decimal to binary conversion. PHP provides us with a built-in function, decbin() for this purpose.The decbin() function in PHP is used to return a string containing a binary 1 min read PHP bindec( ) Function While working with numbers, many times we need to convert the bases of number and one of the most frequent used conversion is binary to decimal conversion. PHP provides us with a built-in function bindec() for this purpose. The bindec() function in PHP is used to return the decimal equivalent of the 1 min read PHP Array Functions Arrays are one of the fundamental data structures in PHP. They are widely used to store multiple values in a single variable and can store different types of data, such as strings, integers, and even other arrays. PHP offers a large set of built-in functions to perform various operations on arrays. 7 min read PHP mb_chr() Function The mb_chr() function is an inbuilt function in PHP that is used to return the character unicode point value that is encoded into the specified encoding. Syntax: string|false mb_chr(int $codepoint, string $encoding = null) Parameters: This function accepts two parameters that are described below: $c 1 min read Like