Page 1 of 1

Eliminate <p> tags in my echo command?

Posted: Sun Oct 16, 2005 11:04 pm
by VKX
How can I eliminate <p> tags in my return? Here's the code, followed by the output, followed by what I would like the output to look like.

Code: Select all

while ($i < 1): 
    $date = mysql_result($rs,$i,"date");
    $subject = mysql_result($rs,$i,"subject");
    $text = mysql_result($rs,$i,"text");
	preg_match('#^\s*(.{500,}?)\s+.*$#s', $text, $return); 
	echo "<p>" . $return[1] . "...</p>";
    $i++; 
    endwhile;
Current Output:

We're got a brand new guest skin (SUGARCULT!) by a brand new additon to our team, Julie Morris!

There's a lot of buzz regarding AwesomeStart Version 2.0 flying around the net, so it would probably be a good idea to clear some of this up. We have set a temporary online launch date of 10.22.2005 (next Saturday). This is the FIRST TIME we've set a launch date, so anything else you've heard is false. We will not be charging any kind of...

Desired Output:

We're got a brand new guest skin (SUGARCULT!) by a brand new additon to our team, Julie Morris! There's a lot of buzz regarding AwesomeStart Version 2.0 flying around the net, so it would probably be a good idea to clear some of this up. We have set a temporary online launch date of 10.22.2005 (next Saturday). This is the FIRST TIME we've set a launch date, so anything else you've heard is false. We will not be charging any kind of...

Posted: Sun Oct 16, 2005 11:13 pm
by feyd
strip_tags() ?

Posted: Sun Oct 16, 2005 11:18 pm
by VKX
I dont' want to strip all the tags though, just the <p> ones. I have a href tags I want to keep in.

Posted: Sun Oct 16, 2005 11:29 pm
by feyd
str_replace() then, or use strip_tags() with the second argument.