title: PHP remove space from a string
body: <p>I've this piece of code to rename a file by adding the uploading date, but then I want also to remove all spaces</p>
  
  <pre><code>rename("./uploads/" . "$directory/" . $mvcfile-&gt;FileName , "./uploads/" . "$directory/" . $data . "_" . $mvcfile-&gt;FileName);
  </code></pre>
  
  <p>I've tried with </p>
  
  <pre><code>str_replace (" ", "", $mvcfile-&gt;FileName);
  </code></pre>
  
  <p>but it doesn't work.</p>
  
  <p>Any idea of why? I'm pretty new to PHP: what's "->"? Could be this the hitch?
  Thanks</p>