note 110019 modified in function.utf8-decode by danbrown

From: Date: Wed, 12 Sep 2012 17:27:51 +0000
Subject: note 110019 modified in function.utf8-decode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-190661@lists.php.net to get a copy of this message
I personally prefer this method for decoding an array:

<?php
private function utf8DecodeArray(&$item, $key) {
 $item = utf8_decode($item);
}
?>

Then just call it like this within the same class:
array_walk_recursive($YOURARRAY, array(&$this, 'utf8DecodeArray'));

This will replace your array with the utf8 decoded one. --was-- I personally prefer this method for decoding an array: private function utf8DecodeArray(&$item, $key) { $item = utf8_decode($item); } Then just call it like this within the same class: array_walk_recursive($YOURARRAY, array(&$this, 'utf8DecodeArray')); This will replace your array with the utf8 decoded one. http://php.net/manual/en/function.utf8-decode.php

« previous php.notes (#190661) next »