PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
function reverseURLTags($text){
if(preg_match("#<a href=\"(.+?)\" target=\"_blank\">(.+?)</a>#im,$text,$rurls)){
return str_replace($rurls[0],"[url={$rurls[1]}]{$rurls[2]}[/url]",$text);
}
}
It says 'unexpected '[' on line 258' -- the str_replace line
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
ah, i see the error now, thanks to the boards syntax highlighting =]
sorry.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
on a side note, anyone looking to perhaps used that function should use preg_match_all (instead of preg_match) and then loop through the array and str_replace()
function reverseURLTags($text){
if(preg_match_all("#<a href=\"(.+?)\" target=\"_blank\">(.+?)</a>#im",$text,$rurls)){
$i=0;
foreach($rurls[0] AS $url){
$text = str_replace($url,"[url={$rurls[1][$i]}]{$rurls[2][$i]}[/url]",$text);
$i++;
}
}
return $text;
}
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.