iconv_get_encoding()

iconv_get_encoding() — Retrieve internal configuration variables of iconv extension.

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.

Signature

iconv_get_encoding(string $type = "all"): array|string|false

Parameters

ParameterTypeWhat it takes
$typestringThe value of the optional type can be: all input_encoding output_encoding internal_encoding

Return value

Returns the current value of the internal configuration variable if successful or false on failure. If type is omitted or set to "all", iconv_get_encoding() returns an array that stores all these variables.

Example

A runnable snippet:

<pre> <?php iconv_set_encoding("internal_encoding", "UTF-8"); iconv_set_encoding("output_encoding", "ISO-8859-1"); var_dump(iconv_get_encoding('all')); ?> </pre>

Output:

Array ( [input_encoding] => ISO-8859-1 [output_encoding] => ISO-8859-1 [internal_encoding] => UTF-8 )

See also

iconv_set_encoding()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page iconv_get_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.