$teststring = "<P><IMG alt=050516102351_20.jpg src=/fileupload/news/IMG11757361772325325293050516102351_20.jpg border=0></P>
<P>123123</P>";echo preg_replace("/<IMG\s*[^>]*>/","",$teststring);
<P>123123</P>";echo preg_replace("/<IMG\s*[^>]*>/","",$teststring);
$tag = "</P>";
$array = explode($tag,$str);
foreach($array as $value)
{
if(strlen($value))
{
if(substr($value,0,7) == "<P><IMG")
{
$line = "<P>";
}
else
{
$line = $value;
}
$out .= $line.$tag;
}
}
echo $out;
$out就是你想要的