How could I replace '$uid=*any digit*' using preg_replace function?
<p>Basically, I need to replace the text inside a php file in-order to slightly change a mysqli query.</p>

<p>I'm using this function:</p>

<pre><code>file_put_contents($file,preg_replace('/^($uid=)[\d]/', '$uid=' . $uid, file_get_contents($file)));
</code></pre>

<p>to replace </p>

<pre><code>$uid=*any digit*
</code></pre>

<p>in the php file represented by $file.</p>

<p>It works perfectly when I match basic patterns, but </p>

<pre><code>'/^($uid=)[\d]/'
</code></pre>

<p>doesn't work for some reason.</p>
