Why won't this PHP string escape right?
<p>This works:</p>

<pre><code>$command = "convert C:\wamp\www\site\uploads\a.jpg -resize 40x30 ^ C:\wamp\www\site\uploads\a-thumb.jpg";

exec($command);
</code></pre>

<p>Since I am using double quotes I thought this would work too:</p>

<pre><code>    $command = "convert C:\wamp\www\site\uploads\$file_name.jpg -resize 40x30 ^ C:\wamp\www\site\uploads\$file_name-thumb.jpg";

    exec($command);
</code></pre>

<p>but the <code>$file_name</code> var isn't being recorgnized as such but it seen as a string for some reason.</p>

<p>So I tried this:</p>

<pre><code>$command = "convert C:\wamp\www\site\uploads\".$file_name.".jpg -resize 40x30 ^ C:\wamp\www\site\uploads\".$file_name."-thumb.jpg";

exec($command);
</code></pre>

<p>But this throws a bunch of syntax errors.</p>

<p>How to escape this string properly? By escape I just mean how can I use this with the variable <code>$file_name</code>.</p>
