iconv_set_encoding()
iconv_set_encoding() — Set current setting for character encoding conversion.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
Changes the value of the internal configuration variable specified by type to encoding.
Signature
iconv_set_encoding(string $type, string $encoding): bool
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $type | string | The value of type can be any one of these: input_encoding output_encoding internal_encoding |
| $encoding | string | The character set. |
Return value
Returns true on success or false on failure.
Example
A runnable snippet:
iconv_set_encoding("internal_encoding", "UTF-8"); iconv_set_encoding("output_encoding", "ISO-8859-1");
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page iconv_set_encoding() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.