-
- /**
- * Array to encoding
- * @param array $array Array to be converted
- * @param String $inCharset Original encoding
- * @param String $outCharset Converted encoding
- * @return $array Converted array
- * @site :bbs.it-home.org
- */
- private function arrayCoding ($array, $inCharset, $outCharset) {
- if (!is_array($array))
- return false;
- foreach ( $array as $key => &$value) {
- if (is_array($value)) {
- $value = $this->arrayCoding($value, $inCharset, $outCharset);
- } else {
- $ value = iconv($inCharset, $outCharset, $value);
- }
- }
- return $array;
- }
-
-
Copy code
>>> For more articles on PHP array encoding conversion, please refer to:
php encoding conversion function (automatic character set conversion supports array conversion)
Examples of php object conversion to array and array conversion to object (picture and text)
php automatically detects content encoding and converts code
Method of array encoding conversion in php
PHP array encoding conversion method reference
Learn the conversion and judgment of PHP string encoding
|