It worked but what if $myarray comes from
trim($_POST['name']);
$myarray = explode(" ", $_POST['name']);
What I want to do is remove all the spaces from the $_POST
so if in the input form someone writes "John (5 spaces) Smith "
transform this into "John Smith" my idea was to explode this, then remove empty values in the array and then implode the new array with just one space :p