iconv_mime_encode

FunctionParams and return types changed in PHP 8.0

Composes a MIME header field.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
PHP 8.2-8.3
PHP 8.4
PHP 8.5
PHP 8.6

iconv_mime_encode Function synopsis

iconv_mime_encode(
    string $field_name,
    string $field_value,
    array $options = []
  ): string|false

Parameters

$field_name

Typestring

The field name.

$field_value

Typestring

The field value.

$options

OptionalTypearrayDefault value[]

You can control the behaviour of iconv_mime_encode by specifying an associative array that contains configuration items to the optional third parameter $options. The items supported by iconv_mime_encode are listed below. Note that item names are treated case-sensitive.

Return value

Typestring|false

Returns an encoded MIME field on success, or false if an error occurs during the encoding.

Changes to the iconv_mime_encode Function

PHP 8.0

  • Return type added: string|false
  • Parameter type added for parameter #1 ($field_name): string
  • Parameter type added for parameter #2 ($field_value): string
  • Parameter name of parameter #3 changed: $preference to $options
  • Parameter type added for parameter #3 ($options): array
  • Parameter default value added for position #3 ($options): []
  iconv_mime_encode(
-     $field_name,
+     string $field_name,
-     $field_value,
+     string $field_value,
-     $preference
+     array $options = []
-   )
+   ): string|false

iconv_mime_encode Function Availability

PHP VersionAvailability
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