Código PHP:
function parse_bbcode(&$var)
{
$filter = array (
'/\[B\]([^\[\]]+)\[\/B\]/i',
'/\[URL="([^\n\r\[\]]+)"\](.+)\[\/URL\]/i',
'/\[URL\](.+)\[\/URL\]/i',
'/\[IMG\](.+)\[\/IMG\]/i'
);
$replace = array (
'<strong>$1</strong>',
'<a href="$1">$2</a>',
'<a href="$1">$1</a>',
'<img src="$1" alt="">'
);
$var = preg_replace($filter, $replace, htmlspecialchars($var));
}
/* cuando var vale [URL="http://www.torneosnydus.com?id=121"]asfsfsjh[/URL] no me funciona */
![Pensando](http://static.forosdelweb.com/fdwtheme/images/smilies/scratchchin.gif)
gracias.