PHP Function Reference

PHP quoted_printable_encode() Function



The PHP quoted_printable_encode() function converts a 8 bit string to a quoted-printable string.

The Quoted-Printable encoding is intended to represent data that largely consists of octets that correspond to printable characters in the US-ASCII character set. It encodes the data in such a way that the resulting octets are unlikely to be modified by mail transport. If the data being encoded are mostly US-ASCII text, the encoded form of the data remains largely recognizable by humans. A body which is entirely US-ASCII may also be encoded in Quoted-Printable to ensure the integrity of the data should the message pass through a character-translating, and/or line-wrapping gateway.

Syntax

quoted_printable_encode(string)

Parameters

string Required. Specify the input string.

Return Value

Returns the encoded string.

Example:

The example below shows the usage of quoted_printable_encode() function.

<?php
$str = "Hëllo World!";

$encode_str = quoted_printable_encode($str);

echo "Encoded string is: $encode_str \n";
?>

The output of the above code will be:

Encoded string is: H=C3=83=C2=ABllo World!  

❮ PHP String Reference