PHP trim doesn't work in my case : <p>I have the next situation:</p>

<pre><code>$a = '   0226  ';
</code></pre>

<p>I'm trying to remove whitespaces from the beginning and end of the string:</p>

<pre><code>print_r(trim($a));
</code></pre>

<p>and expected output is:</p>

<pre><code>'0226'
</code></pre>

<p>Here are results of <code>var_dump</code> and <code>urlencode</code> of above string:</p>

<pre><code>print_r(urlencode($a)); // %C2%A0+0226+%C2%A0
var_dump($a) // &lt;pre class='xdebug-var-dump' dir='ltr'&gt;&lt;small&gt;string&lt;/small&gt; &lt;font color='#cc0000'&gt;'  0226  '&lt;/font&gt; &lt;i&gt;(length=10)&lt;/i&gt;
&lt;/pre&gt;
</code></pre>
