Explode and str_replace
<p>I have the following code</p>

<pre><code>while (strpos($r, "[url]") !== FALSE){
    $link = explode("[url]", $r);
    $final_link = explode("[/url]", $link[0]);

    $thelink = $final_link[0];
}
$r = str_replace("[url]","[url=$thelink]",$r);
</code></pre>

<p>If <code>$r = [url]www.google.com[/url]</code>, I need to turn this into <code>[url=www.google.com]www.google.com[/url]</code></p>

<p>This code doesn't seem to be doing it. Have I missed something?
Give me a 500 error!</p>

<p>Thanks</p>
