Serialize and array_map question

Hi Guys!

I have the following piece of code which should apply all functions to each item in the array and then serialize it. However, ucfirst() is not getting applied. All of the others are working except ucfirst(). Any ideas why?


if(!empty($_POST['language'])){
   $languages = serialize(
   array_map('strtolower', 
   array_map('trim', 
   array_map('ucfirst', 
   explode(",", $_POST['language'])))));
}

Because your mapping the array with strtolower after ucfirst…
So it should be:

if(!empty($_POST['language'])){
    $languages = serialize(
        array_map('ucfirst', 
            array_map('trim', 
                array_map('strtolower', 
                    explode(",", $_POST['language'])
                )
            )
        )
    );
}

Oops thanks