you can do this by usingstrip_tags
function
¶ strip_tags — Strip HTML and PHP tags from a string
strip_tags($contant,'tag you want to allow');
like
strip_tags($contant,'<code><p>');
More Related Contents:
- Date format using dd/mm/yyyy using HTML
- Turn Plain Text URLs into Active Links using PHP [closed]
- How to extract img src, title and alt from html using php? [duplicate]
- Extract URLs from text in PHP
- Opening/closing tags & performance?
- How to replace text URLs and exclude URLs in HTML tags?
- How to strip a tag and all of its inner html using the tag’s id?
- PHP Regular expression to match keyword outside HTML tag
- RegExp to strip HTML comments
- Need a good regex to convert URLs to links but leave existing links alone
- Using PHP to get DOM Element
- How to echo in PHP, HTML tags
- How to get Open Graph Protocol of a webpage by php?
- Count all HTML tags in page PHP
- Regex matching table rows in HTML [duplicate]
- Strip HTML tags and its contents
- How to convert multiple tag to a single tag in php
- Regex ignore URL already in HTML tags
- PHP/regex: How to get the string value of HTML tag?
- xss attack on a php page
- Slice an url with regex – php [closed]
- .php file on website, source in html [closed]
- How to call a PHP function on the click of a button
- How do you parse and process HTML/XML in PHP?
- Remove multiple whitespaces
- Scrape web page contents
- Why is textarea filled with mysterious white spaces?
- Find JSON strings in a string
- Convert HTML to Image in PHP without shell
- How to get the shortest rather than longest possible regex match with preg_match()