protected function flattenArray(array $values, $previous = '')
    {
        $result = array();
        foreach ($values as $key => $value) {
            if ($previous) {
                $key = $previous.'['.$key.']';
            }
            if (is_array($value)) {
                $result = $result + $this->flattenArray($value, $key);
            } else {
                $result[$key] = $value;
            }
        }

        return $result;
    }
protected function flattenArray(array $values, $previous = '')
    {
        $result = array();
        foreach ($values as $key => $value) {
            if ($previous) {
                $key = $previous.'['.$key.']';
            }
            if (is_array($value)) {
                $result = $result + $this->flattenArray($value, $key);
            } else {
                $result[$key] = $value;
            }
        }

        return $result;
    }
protected function flattenArray ( array $ values , $ previous = '' ) { $ result = array ( ) ; foreach ( $ values as $ key => $ value ) { if ( $ previous ) { $ key = $ previous . '[' . $ key . ']' ; } if ( is_array ( $ value ) ) { $ result = $ result + $ this -> flattenArray ( $ value , $ key ) ; } else { $ result [ $ key ] = $ value ; } } return $ result ; }
Flatten a multidimensional array into a one-dimensional array, using
square brackets to show the structure of the original array.
Flatten a multidimensional array into a one - dimensional array using square brackets to show the structure of the original array .