I am trying to create a script that will help me convert urls provided by users in their blog posts of PM to other users into a real clickable links , The script i created is working fine except that it is not converting after the 2nd link occurred in the post , I hope someone can help me with that.
Here is the code :

PHP Code:

="Click [link]http://www.google.com.eg[/link] or click [link]http://www.yahoo.com[/link] or click [link]http://www.hotmail.com[/link]";


$text=str_replace($links[0][$i],"<a href=\"" $link_url "\">" $link_url "</a>",$text);