How to replace data from dynamic <a href="...." /> hyperlinks in php?
<p>I got blocks of div hyperlinks as string in $code. This is example of blocks found in $code:</p>

<pre><code>         &lt;div id="" class="thumbo"&gt;
            &lt;a href="/spring/days/fridayDay12/989876/" /&gt;&lt;img src="http://www.somesite.com/pics/pic12345.jpg&amp;token=32453454645efgdgfdgdfgdfg"&gt;&lt;/a&gt;

         &lt;/div&gt;
</code></pre>

<p>i want to replace everything before 4th slash with ./doit.php.id= 
For example i want change this :</p>

<pre><code>&lt;div id="" class="thumbo"&gt;
                &lt;a href="/spring/days/fridayDay12/989876/" /&gt;&lt;img src="http://www.somesite.com/pics/pic12345.jpg&amp;token=32453454645efgdgfdgdfgdfg"&gt;&lt;/a&gt;

             &lt;/div&gt;
</code></pre>

<p>to </p>

<pre><code>&lt;div id="" class="thumbo"&gt;
                &lt;a href="./doit.php?id=989876" /&gt;&lt;img src="http://www.somesite.com/pics/pic12345.jpg&amp;token=32453454645efgdgfdgdfgdfg"&gt;&lt;/a&gt;

             &lt;/div&gt;
</code></pre>

<p>The problem is that data before last 4th slash is dynamic and wonder how i can replace them all with ./doit.php?id=?</p>
