Well, this is reverse BBCode
For my reverse BBCode code, I have the following:
But, If $string is "<img src="images/(l).gif">", it dosn't display "(l)", it just displays "<img src="images/(l).gif">".PHP Code:function reversebb($string)
{
$bbcode = array('[b]\\1[/b]',
'[strike]\\1[/strike]',
'[u]\\1[/u]',
'[color=\\1]\\2[/color]',
':heart:',
':diamond:',
':club:',
':spade:',
':tm:',
'(l)',
'[i]\\1[/i]',);
$replace = array("'<b>(.*?)</b>'",
"'<strike>(.*?)</strike>'",
"'<u>(.*?)</u>'",
"'<font color=\"(.*?)\">(.*?)</font>'",
"'♥'",
"'♦'",
"'♣'",
"'♠'",
"'™'",
"'<img src=\"images/(l).gif\">'",
"'<i>(.*?)</i>'",);
$string = preg_replace($replace, $bbcode, $string);
$string = str_replace("\n", "", $string);
$string = str_replace("<br />\n", "\n", $string);
$string = str_replace("<br />", "", $string);
return $string;
}
Can anyone see whats wrong?






Reply With Quote



