Project

General

Profile

Feature #20777 » 11571_patch_2.diff

Administrator Admin, 2010-08-09 17:13

View differences:

t3lib/class.t3lib_div.php (working copy)
}
/**
* Takes an array and returns a flattened array
* Usage: 1
*
* @param array recursive array
* @return array flat array
*/
public static function flattenArray(array $array) {
do {
$subArraysFound = false;
foreach($array as $key => $value) {
if(is_array($value)){
foreach($value as $subkey => $subvalue) {
if(is_array($subvalue)) {
$subArraysFound = true;
}
$array[$key.$subkey] = $subvalue;
}
unset($array[$key]);
}
}
} while($subArraysFound);
return $array;
}
/**
* Creates recursively a JSON literal from a multidimensional associative array.
* Uses native function of PHP >= 5.2.0
*
(2-2/4)