public static function flatten($array, $glue = ':', $reset = true, $indexed = true)
    {
        static $return = array();
        static $curr_key = array();

        if ($reset) {
            $return = array();
            $curr_key = array();
        }

        foreach ($array as $key => $val) {
            $curr_key[] = $key;
            if (is_array($val) and ($indexed or array_values($val) !== $val)) {
                static::flatten_assoc($val, $glue, false);
            } else {
                $return[implode($glue, $curr_key)] = $val;
            }
            array_pop($curr_key);
        }
        return $return;
    }
public static function flatten($array, $glue = ':', $reset = true, $indexed = true)
    {
        static $return = array();
        static $curr_key = array();

        if ($reset) {
            $return = array();
            $curr_key = array();
        }

        foreach ($array as $key => $val) {
            $curr_key[] = $key;
            if (is_array($val) and ($indexed or array_values($val) !== $val)) {
                static::flatten_assoc($val, $glue, false);
            } else {
                $return[implode($glue, $curr_key)] = $val;
            }
            array_pop($curr_key);
        }
        return $return;
    }
public static function flatten ( $ array , $ glue = ':' , $ reset = true , $ indexed = true ) { static $ return = array ( ) ; static $ curr_key = array ( ) ; if ( $ reset ) { $ return = array ( ) ; $ curr_key = array ( ) ; } foreach ( $ array as $ key => $ val ) { $ curr_key [ ] = $ key ; if ( is_array ( $ val ) and ( $ indexed or array_values ( $ val ) !== $ val ) ) { static :: flatten_assoc ( $ val , $ glue , false ) ; } else { $ return [ implode ( $ glue , $ curr_key ) ] = $ val ; } array_pop ( $ curr_key ) ; } return $ return ; }
Flattens a multi-dimensional associative array down into a 1 dimensional
associative array.

@param $array
@param string $glue
@param bool $reset
@param bool $indexed
@return array
Flattens a multi - dimensional associative array down into a 1 dimensional associative array .