I can get this to work:
$string = " “Test” ";
$search = array(chr(145), chr(146), chr(147), chr(148));
$replace = array("'", "'", '"', '"');
$string = str_replace($search, $replace, $string);
but it does not work with the string I submit! really weird. Never seen this before.
string:
works in the above script, but not when I use it in my class.
function bbcode_to_html($bb2html){
//find and replace b, url and img
$bb2html = preg_replace_callback("/\[b\](.+?)\[\/b\]/i", array(get_class($this), 'get_b'), $bb2html);
$bb2html = preg_replace_callback("/\[url\](.+?)\[\/url\]/i", array(get_class($this), 'get_link'), $bb2html);
$bb2html = preg_replace_callback("/\[img\]http://(.+?)\[\/img\]/i", array(get_class($this), 'get_image'), $bb2html);
//clean up all unclosed tags
$bb2html = str_replace('[b]','',$bb2html);
$bb2html = str_replace('[b]','',$bb2html);
$bb2html = str_replace('[/b]','',$bb2html);
$bb2html = str_replace('[/b]','',$bb2html);
$bb2html = str_replace('[url=http://','',$bb2html);
$bb2html = str_replace('[url]','',$bb2html);
$bb2html = str_replace(']','',$bb2html);
$bb2html = str_replace('[url]','',$bb2html);
$bb2html = str_replace('[/url]','',$bb2html);
$bb2html = str_replace('[/url]','',$bb2html);
$bb2html = str_replace('[img]','',$bb2html);
$bb2html = str_replace('[img]','',$bb2html);
$bb2html = str_replace('[/img]','',$bb2html);
$bb2html = str_replace('[/img]','',$bb2html);
$bb2html = str_replace('[/','',$bb2html);
$bb2html = str_replace('[','',$bb2html);
$bb2html = str_replace(']','',$bb2html);
//echo $bb2html;
//echo '<br /><br />';
$search = array(chr(145), chr(146), chr(147), chr(148));
$replace = array("'", "'", '"', '"');
$bb2html = str_replace($search, $replace, $bb2html);
//echo $bb2html;
//exit;
return $bb2html;
}
as you see I outputted it twice to see what going on and it simply outputs:
What is there to overlook here?
is this some bizar chartype issue? [sight]