I am struggling to get `$_POST` values capitalize and removing underscore if it is not the `mailaddress` field. I am almost there but not able to remove the underscore from checkbox group array. Also, I believe, there must be some better way to optimize this code.

```
$_POST = str_replace( '_', ' ', $_POST );

foreach ( $_POST as $k => $v ) {
    if ( ! is_array( $v ) && $k != 'mailaddress' ) {
        $_POST[ $k ] = ucwords( $v );
    } else if ( is_array( $v ) ) {
        $_POST[ $k ] = array_map( 'ucwords', $v );
    }
}

```

Input
=====

```
Array
(
    [Q1] => Array
        (
            [0] => tag
            [1] => bil_mc
            [2] => cykel_gang
        )

    [Q2] => 1 3 ganger per manad
    [Q3] => pa fritiden
    [Q4] => Array
        (
            [0] => koper_biljett_i_appen
            [1] => jojo_reskassa
            [2] => jojo_period
            [3] => reser_aldrig_kollektivt
        )

    [mailaddress] => 'me@email.com'

    ...

);

```

Looking for end result
======================

```
Array
(
    [Q1] => Array
        (
            [0] => Tag
            [1] => Bil Mc
            [2] => Cykel Gang
        )

    [Q2] => 1 3 Ganger Per Manad
    [Q3] => Pa Fritiden
    [Q4] => Array
        (
            [0] => Koper Biljett I Appen
            [1] => Jojo Reskassa
            [2] => Jojo Period
            [3] => Reser Aldrig Kollektivt
        )

    [mailaddress] => 'me@email.com'

    ...

);

```

Any help or sugession please???