note 88537 modified in function.utf8-encode by danbrown
| From: | danbrown@php.net | Date: | Thu, 29 Jan 2009 17:11:22 +0000 |
| Subject: | note 88537 modified in function.utf8-encode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149951@lists.php.net to get a copy of this message | ||
This function may be useful do encode array keys and values:
<?php
function to_utf8($in) {
if (is_array($in)) {
foreach ($in as $key => $value) {
$out[to_utf8($key)] = to_utf8($value);
}
} elseif(is_string($in)) {
return utf8_encode($in);
} else {
return $in;
}
return $out;
}
?>
--was--
This function may be useful do encode array keys and values:
<?php
function to_utf8($in) {
if (is_array($in)) {
foreach ($in as $key => $value) {
$out[to_utf8($key)] = to_utf8($value);
}
} elseif(is_string($in)) {
return 'test'.utf8_encode($in);
} else {
return 'test'.$in;
}
return $out;
}
?>
http://php.net/manual/en/function.utf8-encode.php