How to get rid of whitespace in a string, php
<p>So, I've tried using trim and str_replace, and I just can't figure it out.  I've googled it, and nothing seems to be working.</p>

<p>here is my code:</p>

<pre><code>function convertcurrency($euro){
if (is_numeric($euro)) {
    $currency = file_get_contents("http://www.google.com/ig/calculator?hl=en&amp;q=".$euro."EUR%3D%3FUSD");
    $contents = array_map('trim', explode(" ", $currency));
    $getint = array_map('trim', explode("\"", $contents[3]));
    unset($getint[0]);
    $usdollar = implode(" ", $getint);
    echo "$euro Euro's is equal to $usdollar U.S. Dollars";
}
else{
    echo "$euro is not a number, please enter a number.";
}
}

convertcurrency(123123);

?&gt;
</code></pre>

<p>Thanks!</p>

<p>Edit:</p>

<p>I apologize, I should have posted my output, and expected output.</p>

<p>Output: 123123 Euro's is equal to 162 362.3 U.S. Dollars 
Expected output: 123123 Euro's is equal to 162362.3 U.S. Dollars </p>

<p>Once I get rid of the whitespace, I can use the money_format function to display it properly.</p>
