Using str_replace to remove spaces for exec()
<p>I'm running into an issue with the function <code>str_replace()</code> while trying to create a shell command in PHP. In shell, when I tab-finish a line that has spaces, it comes up like this:</p>

<pre><code>tar cvfz destination/filename.zip source/Name\ Of\ The\+\ Folder
</code></pre>

<p>So to me, this says that in order to run this command via <code>exec()</code>, I need to replace any spaces I would have in a string in PHP. To remedy this problem, I'm using</p>

<pre><code>$q = str_replace(' ', '\ ' , $q);
</code></pre>

<p>at the start of my string parse, in order to format the spaces into "\ " instead of " ". The issue I'm having is that for this particular folder, it's also removing the plus symbol as well, and it formats it like this:</p>

<pre><code>tar cvfz destination/Name\ Of\ The\ \ \ Folder.tgz source/Name\ Of\ The\ \ \ Folder
</code></pre>

<p>How can I set this up so <code>str_replace()</code> doesn't remove the plus sign? From my limited tests so far, it isn't removing anything out of these: <code>-, %, @, !, (, *, ), ^, =</code></p>
