function Array_iconv ($in _charset, $out _charset, $arr) {return eval (' Return '. Iconv ($in _charset, $out _charset,var_ Export ($arr, true). '; '); Copy Code Rationale analysis: Var_export set the second argument to true, return the array prototype string, convert the string to Utf-8 encoding, and then use Eval to perform the return (like anonymous function?). ) to solve the problem perfectly. Follow-up: The method found on the Internet, mostly using recursive call Iconv way, if the array elements too much or more dimension, performance is certainly not how, better is the way of native code, do not need to consider whether it is n-dimensional array or associative array, everything has been automatically completed, to ensure that the data before and after the array conversion. From the length of the code
1. A detailed description of the array encoding
Description: Function Array_iconv ($in _charset, $out _charset, $arr) {return eval (' Return '. Iconv ($in _charset, $out _charset,var_ Export ($arr, true). '; '); Copy Code Rationale analysis: Var_export sets the second argument to True, returns the array prototype string, converts the string to UTF-...
2. Recommended Articles for PHP filegroup () functions
Introduction: PHP Filegroup function filegroup (PHP 4, PHP 5) archive Group-gets filegroup describes the International archive group (string $ file name) obtained by filegroup. Returns the format of the numeric value in the ID of the owning group, use Posix_getgrgid () to resolve the problem by a set of names. parameter filename file path. The return value returns the group number of the file, or False if the error occurs. Belongs...
3. PHP array encoding Conversion small example
Introduction: PHP array encoding Conversion small example
4. How to convert array encoding in PHP
Introduction: How to convert array encoding in PHP
5. PHP array Encoding conversion method reference
Introduction: PHP Array encoding conversion method reference
6. Converting an array encoding
Introduction: Converting an array encoding
7. PHP array Encoding Conversion example Demo _php Tutorial
Introduction: PHP array encoding conversion example Demo. Using the Var_export function to construct the array prototype, the final function is as follows: The code reads function Array_iconv ($in _charset, $out _charset, $arr) {return eval (' return ') . Iconv ($
8. PHP array Encoding conversion Example _php tutorial
Introduction: Examples of PHP array encoding conversions are detailed. Because some special character's display effect reason had to change the custom Utf-8 project to the GBK, because uses the AJAX technology, but also involves the old question--the code conversion. Some form tests
9. PHP array Encoding conversion function Example _php Tutorial
Summary: An example of a PHP array encoding conversion function. Scenario Description/Problem Description: The AJAX submission page is encoded as gb2312, the database is encoded as UTF8, and the data is inserted without changing the page and database encoding. Custom functions: The code is as follows
How to convert PHP array encoding
Introduction: How to convert PHP array encoding
"Related question and answer recommendation":
Javascript-localstorage method of saving object array
Algorithm-A python topic: how to put a tuple programming dictionary?