This function is powerful, compared to PHP's own function is much more powerful, this function can automatically get the character code you give, and then according to your reference to convert to the code you want, a friend can refer to the need.
| The code is as follows |
Copy Code |
/**
* Cyclic implementation of coded cross-transfer
*
* @param string $param (String, object, or array), $currCharset current encoding, $toCharset expected encoding
* @return Parameter types
*/
function Zhandi_iconv ($param, $currCharset, $toCharset) {
if ($currCharset! = $toCharset) {
if (is_string ($param)) {
Return Iconv ($currCharset, $toCharset, $param);
}
ElseIf (Is_array ($param)) {
foreach ($param as $key = = $value) {
$param [$key] = Zhandi_iconv ($value);
}
return $param;
}
ElseIf (Is_object ($param)) {
foreach ($param as $key = = $value) {
$param $key = Zhandi_iconv ($value);
}
return $param;
}
else{
return $param;
}
}
return $param;
} |
http://www.bkjia.com/PHPjc/632259.html www.bkjia.com true http://www.bkjia.com/PHPjc/632259.html techarticle This function is powerful, compared to PHP's own function is much more powerful, this function can automatically get the character code you give, and then according to your reference to convert to the code you want, there is need ...