how to remove html tags from string in php?

Today, We want to share with you how to remove html tags from string in php?.In this post we will show you php remove html entities, hear for php remove html tags keep content we will give you demo and example for implement.In this post, we will learn about Delete Html tags from string PHP with an example.

Removing HTML from a string

Example 1: PHP strip_tags() Function

<!DOCTYPE html>
echo strip_tags("Welcome <b>Pakainfo!</b>");

Example 2:

    $str_data = "<blink><strong>Welcome!</strong></blink>";
    $a = strip_tags($str_data);
    $b = strip_tags($str_data, "<strong><em>");

PHP Code

$str = '<p>Tamil Rockers.</p><!-- Comment --> <a href="#new_content">Love Website</a>';
echo strip_tags($str);   //output Tamil Rockers. Love Website

<?php echo substr(strip_tags($resoponse_user_bio_data['user_bio_data']),0,110) . "..."; ?>

I hope you get an idea about how to remove html tags from string in codeigniter.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  how to remove html tags in php from mysql?

About Pakainfo

I am Jaydeep Gondaliya, a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Pakainfo →

Leave a Reply

Your email address will not be published. Required fields are marked *