note 101917 added to function.iconv
| From: | perhydrol dot pl at gmail dot com | Date: | Tue, 18 Jan 2011 10:20:25 +0000 |
| Subject: | note 101917 added to function.iconv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175849@lists.php.net to get a copy of this message | ||
I needed a method for recursive iconv. I didn't find one, so wrote it myself and I'd like
to share it. Mabye someone will need it.
public function recursive_iconv(string $in_charset, string $out_charset, $arr){
if (!is_array($arr)){
return iconv($in_charset, $out_charset, $arr);
}
$ret = $arr;
function array_iconv(&$val, $key, $userdata){
$val = iconv($userdata[0], $userdata[1], $val);
}
array_walk_recursive($ret, "array_iconv", array($in_charset, $out_charset));
return $ret;
}
----
Server IP: 195.114.0.19
Probable Submitter: 91.198.118.53
----
Manual Page -- http://www.php.net/manual/en/function.iconv.php
Edit -- https://master.php.net/note/edit/101917
Del: integrated -- https://master.php.net/note/delete/101917/integrated
Del: useless -- https://master.php.net/note/delete/101917/useless
Del: bad code -- https://master.php.net/note/delete/101917/bad+code
Del: spam -- https://master.php.net/note/delete/101917/spam
Del: non-english -- https://master.php.net/note/delete/101917/non-english
Del: in docs -- https://master.php.net/note/delete/101917/in+docs
Del: other reasons-- https://master.php.net/note/delete/101917
Reject -- https://master.php.net/note/reject/101917
Search -- https://master.php.net/manage/user-notes.php