static public function flatten(array $array, $prefix = '', $keepEmptyArrayNode = TRUE, $segmentationCharacter = self::SEGMENTATION_CHARACTER) {
		$flatArray = array();
		foreach ($array as $key => $value) {
			// Ensure there is no trailling dot:
			$key = rtrim($key, $segmentationCharacter);
			if (!is_array($value) || (count($value) === 0 && $keepEmptyArrayNode)) {
				$flatArray[$prefix . $key] = $value;
			} else {
				$flatArray = array_merge($flatArray, self::flatten($value, $prefix . $key . $segmentationCharacter, $keepEmptyArrayNode));
			}
		}
		return $flatArray;
	}
static public function flatten(array $array, $prefix = '', $keepEmptyArrayNode = TRUE, $segmentationCharacter = self::SEGMENTATION_CHARACTER) {
		$flatArray = array();
		foreach ($array as $key => $value) {
			// Ensure there is no trailling dot:
			$key = rtrim($key, $segmentationCharacter);
			if (!is_array($value) || (count($value) === 0 && $keepEmptyArrayNode)) {
				$flatArray[$prefix . $key] = $value;
			} else {
				$flatArray = array_merge($flatArray, self::flatten($value, $prefix . $key . $segmentationCharacter, $keepEmptyArrayNode));
			}
		}
		return $flatArray;
	}
static public function flatten ( array $ array , $ prefix = '' , $ keepEmptyArrayNode = TRUE , $ segmentationCharacter = self :: SEGMENTATION_CHARACTER ) { $ flatArray = array ( ) ; foreach ( $ array as $ key => $ value ) { // Ensure there is no trailling dot: $ key = rtrim ( $ key , $ segmentationCharacter ) ; if ( ! is_array ( $ value ) || ( count ( $ value ) === 0 && $ keepEmptyArrayNode ) ) { $ flatArray [ $ prefix . $ key ] = $ value ; } else { $ flatArray = array_merge ( $ flatArray , self :: flatten ( $ value , $ prefix . $ key . $ segmentationCharacter , $ keepEmptyArrayNode ) ) ; } } return $ flatArray ; }
Converts a multidimensional array to a flat representation.

See unit tests for more details

Example:
- array:
array(
'first.' => array(
'second' => 1
)
)
- result:
array(
'first.second' => 1
)

Example:
- array:
array(
'first' => array(
'second' => 1
)
)
- result:
array(
'first.second' => 1
)

@param array $array The (relative) array to be converted
@param string $prefix The (relative) prefix to be used (e.g. 'section.')
@return array
Converts a multidimensional array to a flat representation .