note 105786 deleted from function.utf8-encode by danbrown
| From: | danbrown@php.net | Date: | Thu, 15 Sep 2011 16:03:05 +0000 |
| Subject: | note 105786 deleted from function.utf8-encode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183191@lists.php.net to get a copy of this message | ||
Note Submitter: foxbaucia
----
This is the function of rogeriogirodo with adding inside objects.
<?php
function to_utf8($in) {
if (is_array($in)) {
$out = array();
foreach ($in as $key => $value) {
$out[to_utf8($key)] = to_utf8($value);
}
return $out;
} elseif(is_string($in)) {
return utf8_encode($in);
} elseif (is_object($in)) {
$objAsArray = get_object_vars($in);
$out;
foreach ($objAsArray as $key => $value) {
$out->$key = to_utf8($value);
}
return $out;
} else {
return $in;
}
}
?>