Php code for array conversion supported by the automatic conversion character set
// The automatic conversion character set supports array conversion /******************************* * ****************************** parameter description * fContents: data source * from: data source content encoding *: the converted data content encoding ********************************** * *************************/function auto_charset ($ fContents, $ from, $ to) {$ from = strtoupper ($ from); $ to = strtoupper ($ to); if (strtoupper ($ from) === strtoupper ($) | empty ($ fContents) | (is_scalar ($ fContents )&&! Is_string ($ fContents) {// if the encoding is the same or non-string scalar, return $ fContents is not converted;} if (is_string ($ fContents )) {if (function_exists ('MB _ convert_encoding ') {return mb_convert_encoding ($ fContents, $ to, $ from);} elseif (function_exists ('iconv ')) {return iconv ($ from, $ to, $ fContents) ;}else {return $ fContents ;}} elseif (is_array ($ fContents )) {foreach ($ fContents as $ key => $ val) {$ _ key = auto_charset ($ key, $ From, $ to); $ fContents [$ _ key] = auto_charset ($ val, $ from, $ to); if ($ key! =$ _ Key) unset ($ fContents [$ key]);} return $ fContents;} else {return $ fContents ;}}