PHP String quoted_printable_encode() Function

The quoted_printable_encode() function is a built-in function of PHP which is used to convert an 8-bit string to a quoted-printable string. This function is opposite to the quoted_printable_decode(), and similar to the imap_8bit() function. It returns a quoted printable string that is created according to RFC2045 (MIME http://www.faqs.org/rfcs/rfc2045.html).

The syntax for this function is given below:

Syntax

Parameter

str (mandatory) - This function has only one string parameter as input, which represents the 8-bit string. It is a mandatory parameter.

Values Return

It returns an encoded string.

Supported PHP version

This function can be implemented by PHP 5.3.0+ versions

Examples

There are some examples given below which will help us to understand the quoted_printable_encode() function, and it?s working in a better way.

Example 1

It will encode the 8-bit string into the quoted-printable string.

Browser Output:

The browser output of the following code will be:

H=C3=ABllo Guy! Welcome to javaTpoint.

HTML Output:

The HTML output can be seen by right-clicking on browser output and select View page source. The HTML output for the following code will be:

PHP String quoted_printable_encode() Function

Note: The quoted_printable_encode() function is used in the mailing system to encode any message. We use quoted_printable_decode() function at receiver?s end to decode back to the string.






Latest Courses