mb_encode_mimeheader
Encode string for MIME header.
mb_encode_mimeheader Function synopsis
mb_encode_mimeheader(
string $string,
?string $charset = null,
?string $transfer_encoding = null,
string $newline = "\r\n",
int $indent = 0
): string
Parameters
$string
Typestring
The string being encoded.
Its encoding should be same as mb_internal_encoding.
$charset
OptionalType?stringDefault valuenull
$charset specifies the name of the character set
in which $string is represented in. The default value
is determined by the current NLS setting (mbstring.language).
$transfer_encoding
OptionalType?stringDefault valuenull
$transfer_encoding specifies the scheme of MIME
encoding. It should be either "B" (Base64) or
"Q" (Quoted-Printable). Falls back to
"B" if not given.
$newline
OptionalTypestringDefault value"\r\n"
$newline specifies the EOL (end-of-line) marker
with which mb_encode_mimeheader performs
line-folding (a RFC term,
the act of breaking a line longer than a certain length into multiple
lines. The length is currently hard-coded to 74 characters).
Falls back to "\r\n" (CRLF) if not given.
$indent
OptionalTypeintDefault value0
Indentation of the first line (number of characters in the header
before $string).
Return value
Typestring
A converted version of the string represented in ASCII.
Changes to the mb_encode_mimeheader Function
PHP 8.0
- Return type added:
string - Parameter name of parameter #1 changed:
$strto$string - Parameter type added for parameter #1 (
$string):string - Parameter type added for parameter #2 (
$charset):?string - Parameter default value added for position #2 (
$charset):null - Parameter name of parameter #3 changed:
$transferto$transfer_encoding - Parameter type added for parameter #3 (
$transfer_encoding):?string - Parameter default value added for position #3 (
$transfer_encoding):null - Parameter name of parameter #4 changed:
$linefeedto$newline - Parameter type added for parameter #4 (
$newline):string - Parameter default value added for position #4 (
$newline):"\r\n" - Parameter type added for parameter #5 (
$indent):int - Parameter default value added for position #5 (
$indent):0
mb_encode_mimeheader(
- $str,
+ string $string,
- $charset,
+ ?string $charset = null,
- $transfer,
+ ?string $transfer_encoding = null,
- $linefeed,
+ string $newline = "\r\n",
- $indent
+ int $indent = 0
- )
+ ): string mb_encode_mimeheader Function Availability
mb_encode_mimeheader Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Unsupported | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |