Hm..
maybe try inserting them without the quotes:
replace: /[img](.*?)[\/img]/is
for: <img src="$1" />
Otherwise.. You can always hack this pregreplace function:
function bbcode($data) {
$sql = "SELECT * FROM forum_bbcode";
$result = mysql_query($sql);
if (mysql_num_rows($result) > 0) {
while($row = mysql_fetch_array($result)) {
$bbcode['tpl'][] =
"/" . html_entity_decode($row['template'],ENT_QUOTES). "/i";
$bbcode['rep'][] =
html_entity_decode($row['replacement'],ENT_QUOTES);
}
$search = array(
'/\[b\](.*?)\[\/b\]/is',
'/\[i\](.*?)\[\/i\]/is',
'/\[u\](.*?)\[\/u\]/is',
'/\[img\](.*?)\[\/img\]/is',
'/\[url\](.*?)\[\/url\]/is',
'/\[url\=(.*?)\](.*?)\[\/url\]/is'
);
$replace = array(
'<strong>$1</strong>',
'<em>$1</em>',
'<u>$1</u>',
'<img src="$1" />',
'<a href="$1">$1</a>',
'<a href="$1">$2</a>'
);
foreach($earch as $key => $pattern)
{
$bbcode['tpl'][] = $pattern;
$bbcode['rep'][] $replace[$key];
}
$data1 = preg_replace($bbcode['tpl'],$bbcode['rep'],$data);
$count = 1;
while (($data1 != $data) and ($count < 4)) {
$count++;
$data = $data1;
$data1 = preg_replace($bbcode['tpl'],$bbcode['rep'],$data);
}
}
return $data;
}