I'm adding some code in a knowledge base i'm coding to automatically turn urls into hyperlinks. I'm using the following code:
function MakeURL($String){
$URLs = explode("http://",$String);
echo count($URLs);
for ($I=0; $I=count($URLs); $I++) {
if (eregi("http://www\.(.+)[[:space:]]",$URLs[$I],$Results)) {
$Echo = split(" ", $Results[1]);
$String=str_replace("http://www.$Echo[0]", "<a href=\"http://www.$Echo[0]\">http://www.$Echo[0]</a>", $String);
}
}
return($String);
}
I am testing this with a string containing 2 URLs, and the script exceeds the 30 second time limit on this line:
if (eregi("http://www\.(.+)[[:space:]]",$URLs[$I],$Results)) {
Any ideas/suggestions would be greatly appreciated.
Arta