Find us on twitterLike us on facebook
View Portfolio

PHP Library

Support Us

CSS Library

How to remove HTML tags from data in PHP ? | DevSocial.net How to remove HTML tags from data in PHP ? | DevSocial.net

free php scripts



Listings

How to remove HTML tags from data in PHP ?

How to remove HTML tags from data in PHP ?

Removing HTML tags from data in PHP is a crucial step for sanitizing user input or displaying content safely. This process involves using the strip_tags() function to eliminate any HTML or PHP tags from a string, leaving only plain text. It’s essential for preventing potential security risks, such as cross-site scripting (XSS) attacks, and ensuring that the content is clean and displayed correctly in different contexts.

Syntax:

strip_tags(string, allowed_tags)

Parameters Values:

  • string: It is a required parameter that specifies the string to check.
  • allowed_tags: It is an optional parameter that specifies the allowable tags that will not be removed from the returned result.

Return Value: It returns a string where HTML tags are removed except for the allowed tags.


    
    echo strip_tags(
    "Devsocial.net one of the popular
    online learning site");

?>
OUTPUT:
Devsocial.net one of the popular online learning site

Example 2: The strip_tags() function, with the allowed_tags parameter set to

, preserves

tags while removing others, like , from the input string.

 


echo
strip_tags( "GeeksforGeeks one of the popular online learning site"); ?>


Views: 2,634 / Downloads: 407 | Price: $0 | PHP / PHP How to
Status:

|

You have no Listings. Create Listing.


Buy Ready made Web Apps  Buy Ready made Web Apps


Website Ranking Tools

classifieds24.net classifieds24.info classifieds24.org nywds.com https://www.globalclassifieds.org/ domainpaid.net devsocial.net paystopost.com paystopost.org https://www.101now.com https://www.newyorkconstructionco.com paystopost.org https://www.hirepros.org https://www.hirepros.info
EST: 2012 | © 2026 Devsocial.net | All Rights Reserved. [ + ][ y ]
SHARE:

Facebook

Twitter