高亮显示|函数|字符串
///// by iwind.org coldwind/iwind/month/ccterran
//这个函数是对标签里的内容进行分析,并输出
//例如:
//
以下内容为程序代码
$hello="hello";?>
sssssssssssss';
// highlight($string);
// ?>
//保留了不完全的标签,如只有
以下内容为程序代码
,没有
,则输出中含有[code]
function highlight($string){
$arr=explode("[code]",$string);
$total=sizeof($arr);
for($i=0;$i if(ereg("(.+)\[/code\]",$arr[$i])){
list($astr,$bstr)=split("\[/code\]",$arr[$i],"2");
highlight_string($astr);
echo"$bstr";
}
else{
if($i!="0"){
echo"[code]";
}
echo"$arr[$i]";
}
}
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn