
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
PHP – Retrieve internal configuration variables of iconv extension using iconv_get_encoding() function
In PHP, the iconv_get_encoding() function is used to retrieve the internal configuration variables of iconv extension. This function is an inbuilt PHP function which is being used from PHP 4 version.
Syntax
mixed iconv_get_encoding($type = "all")
Parameter
The iconv_get_encoding() function is used only single parameter $type.
$type − The values of the optional type parameter can be
- all
- input_encoding
- output_encoding
- internal_encoding
Return Value
The iconv_get_encoding() function returns the current value of the internal configuration variable if successful or it returns False on failure. If the type is not present or set to all, then iconv_get_encoding() returns an array that stores all these variables.
Example 1
<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(3) { ["input_encoding"]=> string(5) "UTF-8" ["output_encoding"]=> string(10) "ISO-8859-1" ["internal_encoding"]=> string(5) "UTF-8" }
Explanation - The above PHP program will print all the encoding (internal encoding, output encoding) because iconv_get_encoding() is set to all.
Example 2 - Using only internal_encoding
<?php // Using only internal encoding iconv_set_encoding("internal_encoding", "UTF-8"); var_dump(iconv_get_encoding('internal_encoding')); ?>
Output
string(5) "UTF-8"
- Related Articles
- PHP – Convert a string to a requested character encoding using iconv()
- Access variables from parent scope in anonymous PHP function
- PHP equivalent of friend or internal
- MySQL command for display current configuration variables?
- MySQL command for displaying current configuration variables?
- Retrieve environment variables with Java Map Collection
- PHP Predefined Variables
- PHP variable Variables
- The internal working of the ‘foreach’ loop in PHP
- PHP – Get the internal settings of mbstring with mb_get_info()
- Install Lua in Linux and implement PHP Lua Extension
- How to install Imagick/imagemagick PHP extension on Windows 10?
- How to access variables declared in a function, from another function using JavaScript?
- PHP Variables from External Sources
- How to extract file extension using Python?

Advertisements