Strong PHP Code conversion function _php Tutorial

Source: Internet
Author: User
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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.