Created
March 28, 2012 20:59
-
-
Save renie/2230445 to your computer and use it in GitHub Desktop.
All array values to UTF8 ( recursive, so it works on assiciative array )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertArrayToUtf8(array $array) { | |
$convertedArray = array(); | |
foreach($array as $key => $value) { | |
if(gettype($key)=='string') | |
$key = utf8_encode($key); | |
if(is_array($value)) | |
$value = $this->convertArrayToUtf8($value); | |
if(gettype($value)=='string') | |
$convertedArray[$key] = utf8_encode($value); | |
else | |
$convertedArray[$key] = $value; | |
} | |
return $convertedArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment