- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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"
Advertisements
To Continue Learning Please Login
Login with Google