title: Can't get str_replace() to strip out spaces in a PHP string
body: <p>Hi, I am getting a PHP string which I need to strip the spaces out of. I have used the following code but when I echo <code>$classname</code> it just displays the string still with the spaces in it. </p>
  
  <pre><code>   &lt;?php
       $fieldname = the_sub_field('venue_title');
       $classname = str_replace(' ', '', $fieldname);
       echo $classname;
     ?&gt;
  </code></pre>