Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php strip tags

<?php
$text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
echo strip_tags($text);
//Test paragraph. Other text

// Allow <p> and <a>
echo strip_tags($text, '<p><a>');
//<p>Test paragraph.</p> <a href="#fragment">Other text</a>
// as of PHP 7.4.0 the line above can be written as:
// echo strip_tags($text, ['p', 'a']);
?>

Comment

PHP strip_tags — Strip HTML and PHP tags from a string

<?php
$text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
echo strip_tags($text);
echo "
";

// Allow <p> and <a>
echo strip_tags($text, '<p><a>');

// as of PHP 7.4.0 the line above can be written as:
// echo strip_tags($text, ['p', 'a']);
?>
Comment

strip html tag php

$text = '<a href="https://workforcenow.adp.com/mascsr/default/mdf/recruitment/recruitment.html?cid=ed2438b9-d7f4-45be-b3d8-8c924068c18a&amp;ccId=2036080543_6069&amp;jobId=329838&amp;source=CC2&amp;lang=en_US">https://workforcenow.adp.com/mascsr/default/mdf/recruitment/recruitment.html?cid=ed2438b9-d7f4-45be-b3d8-8c924068c18a&amp;ccId=2036080543_6069&amp;jobId=329838&amp;source=CC2&amp;lang=en_US</a>';
Comment

strip html tag php

$text = '<p>Test paraagraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
Comment

PREVIOUS NEXT
Code Example
:: check if input file is set codeigniter 
Php :: magento colloction query 
Php :: extract all arrays from sql response in php 
Php :: get http method php 
:: WP_Comment_Query get total number of comments fetched 
::  
Php :: combine array except common ones php 
Php :: laravel faker boolean 
Php :: how create new command in laravel 
Php :: php detect mobile 
Php :: decimal to binary php 
Php :: get one column in all associative array in collection laravel 
Php ::  
::  
:: php explode 
Php :: fecade Artisan:call laravel 
Php :: laravel migrate specific file 
Php :: laravel form submit page expired 
:: alert a php variable 
Php :: php get version 
:: how to catch query exception in laravel 8 
Php :: cake tmp name 
Php :: unique sql queries laravel 
:: string to array in laravel 
Php :: php variable outside foreach 
Php ::  
Php :: confirm password validation laravel 
:: php add to array if not exists 
::  
::  
ADD CONTENT
Topic
Content
Source link
Name
4+9 =