Example 1 — Decode Two Headers
Turn a short header block into an array.
<?php
$raw = "Subject: =?UTF-8?Q?Pr=C3=BCfung?=\r\nTo: [email protected]";
print_r(iconv_mime_decode_headers($raw, 0, "UTF-8")); How It Works
- Join the lines with
\r\n. This is how headers are separated. - Call iconv_mime_decode_headers(). Pass
UTF-8as the output. - Get one key per header. The subject is decoded.
- Read the values. Plain headers are kept as they are.

