0

I used

 <br> 

in textarea to write some articles in backend, the output came exactly what i expected on webpage.I used 3rd party apps to share the article description to mobiles and in social netowrking. While sharing the article description the br> tags are seen in the 3rd party apps.

How to remove the
tags from the article description ?

<?php echo ($rows['description']); ?>

I used the below method which removes the
tag but it also removes the line breaks in the artile. How to remove the
tag and not line break in textarea

<?php
$value=$rows['description'];
$sendarticle= preg_replace('/[\<br>]/', '', $value);
?>
2
  • 1
    Have you already tried a simple str_replace? Commented Oct 5, 2012 at 9:39
  • Simple str_replace will do the job, else you can try strip_tags() too Commented Oct 5, 2012 at 9:39

2 Answers 2

3

Use PHP's

strip_tags($str)

function to replace all NULL-Bytes, PHP-Tags and HTML-tags from $str.

Sign up to request clarification or add additional context in comments.

3 Comments

it remove the br tag and also the line break
strip_tags doesn't remove any carriage returns or line feeds.
it removes <br>tag and also removes line break.After removing line break article has no paragraphs
0
<?php echo htmlentities($rows['description']); ?>

try this

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.