public static function flattenArray(array $array, $prefix = '')
    {
        $prefix = self::keySanitize($prefix);
        $result = [];
        foreach ($array as $key => $val) {
            $key = strtolower($key);
            if (is_array($val)) {
                $result += self::flattenArray($val, $prefix.$key.'.');
                continue;
            }
            $key = self::keySanitize($key);
            $newKey = rtrim($prefix.$key, '.');
            $result[$newKey] = $val;
        }
        return $result;
    }
public static function flattenArray(array $array, $prefix = '')
    {
        $prefix = self::keySanitize($prefix);
        $result = [];
        foreach ($array as $key => $val) {
            $key = strtolower($key);
            if (is_array($val)) {
                $result += self::flattenArray($val, $prefix.$key.'.');
                continue;
            }
            $key = self::keySanitize($key);
            $newKey = rtrim($prefix.$key, '.');
            $result[$newKey] = $val;
        }
        return $result;
    }
public static function flattenArray ( array $ array , $ prefix = '' ) { $ prefix = self :: keySanitize ( $ prefix ) ; $ result = [ ] ; foreach ( $ array as $ key => $ val ) { $ key = strtolower ( $ key ) ; if ( is_array ( $ val ) ) { $ result += self :: flattenArray ( $ val , $ prefix . $ key . '.' ) ; continue ; } $ key = self :: keySanitize ( $ key ) ; $ newKey = rtrim ( $ prefix . $ key , '.' ) ; $ result [ $ newKey ] = $ val ; } return $ result ; }
flatten a multi-dimensional array, with concatenated keys

@param array $array
@param string $prefix Optional
@return array
flatten a multi - dimensional array with concatenated keys