Feature #20777 » 11571_patch_2.diff
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
|
||
*
|