note 90718 modified in function.utf8-decode by danbrown

From: Date: Tue, 05 May 2009 22:43:48 +0000
Subject: note 90718 modified in function.utf8-decode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154267@lists.php.net to get a copy of this message
I've modified above utf8_array_decode to utf8_array_encode. The main difference is the later encodes a multi-dimension array. Here goes the code: <?php function utf8_array_encode($input) { $return = array(); foreach ($input as $key => $val) { if( is_array($val) ) { $return[$key] = utf8_array_encode($val); } else { $return[$key] = utf8_encode($val); } } return $return; } ?> Enjoy it! Pedro Bastos --was-- I've modified above utf8_array_decode to utf8_array_encode. The main difference is the later encodes a multi-dimension array. Here goes the code: function utf8_array_encode($input) { $return = array(); foreach ($input as $key => $val) { if( is_array($val) ) { $return[$key] = utf8_array_encode($val); } else { $return[$key] = utf8_encode($val); } } return $return; } Enjoy it! Pedro Bastos http://php.net/manual/en/function.utf8-decode.php

« previous php.notes (#154267) next »