protected function flattenArray(array $array, $separator = null)
    {
        $flattened = array();

        if (is_null($separator)) {
            $separator = $this->separator;
        }

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $flattened = array_merge($flattened, $this->flattenArray($value, $key.$separator));
            } else {
                $flattened[trim($separator.$key, $this->separator)] = $value;
            }
        }

        return $flattened;
    }
protected function flattenArray(array $array, $separator = null)
    {
        $flattened = array();

        if (is_null($separator)) {
            $separator = $this->separator;
        }

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $flattened = array_merge($flattened, $this->flattenArray($value, $key.$separator));
            } else {
                $flattened[trim($separator.$key, $this->separator)] = $value;
            }
        }

        return $flattened;
    }
protected function flattenArray ( array $ array , $ separator = null ) { $ flattened = array ( ) ; if ( is_null ( $ separator ) ) { $ separator = $ this -> separator ; } foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ flattened = array_merge ( $ flattened , $ this -> flattenArray ( $ value , $ key . $ separator ) ) ; } else { $ flattened [ trim ( $ separator . $ key , $ this -> separator ) ] = $ value ; } } return $ flattened ; }
Flatten a nested array to a separated key

@param  array  $array
@param  string $separator
@return array
Flatten a nested array to a separated key