W3docs

quoted_printable_encode()

Our article is about the PHP function quoted_printable_encode(), which is used to encode a string into a quoted-printable format. This function is useful for

The PHP quoted_printable_encode() function is used to encode a string into a quoted-printable format. This function is useful for working with email messages in PHP.

Syntax

string quoted_printable_encode ( string $str )

The function takes one parameter, $str. The $str parameter is the string to be encoded.

Example

<?php
$string = 'Hello World!';
echo quoted_printable_encode($string);
?>

Output:

Hello World!

In this example, we have a string variable $string. We use the quoted_printable_encode() function to encode the string into a quoted-printable format. Since the input contains only standard ASCII characters, the output remains unchanged. When the string includes non-ASCII characters, they are converted to the =XX hexadecimal format (e.g., é becomes =E9).

The quoted_printable_encode() function is a useful tool for working with email messages in PHP. It can help you encode strings into a quoted-printable format, which is useful for various purposes such as email message creation and transmission.

We hope this article has been helpful in understanding the quoted_printable_encode() function in PHP.

Practice

Practice

What does the quoted_printable_encode() function in PHP do?