vnpenguin wrote:I'm trying use these functions. It seems ok. But I have problem with < and >: there are not displayed in the code.
Any fix ?
Thanks,
Here you go. May not be a great fix, but it works. The > & < where getting processed two times, so the end results becomes < and > I added str_replace for those, you cld add more values into that array
function hilight($text,$lang){
$result='';
//recontruct the string
$text='[h='.$lang.']'.$text.'[/h]';
$array= preg_split('#\[/h\]#',$text,-1,PREG_SPLIT_NO_EMPTY);
for ( $counter = 0; $counter <count($array); $counter ++) {
$result=$result . preg_replace('#\[h=(.*?)\]((.|\s)*)\[/h\]#e','geshify(\'$2\', \'$1\')',$array[$counter].'[/h]');
}
$r_this = array("<", ">",""","&");
$r_with = array("<",">",'"',"&");
$result = str_replace($r_this,$r_with, $result);
return $result;
}
here's the code changed
$r_this = array("<", ">",""","&");
$r_with = array("<",">",'"',"&");
$result = str_replace($r_this,$r_with, $result);