Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Remove all attributes from HTML tags in PHP

$text = '<div class="test"><p onmousemove="javascript:alert(1);">Clean <a href="#">text</a></p></div>';

$cleanText = preg_replace("/<([a-z][a-z0-9]*)[^>]*?(/?)>/si",'<$1$2>', $text);
Comment

PREVIOUS NEXT
Code Example
Php :: how to create compomemt in laravel livewire 
Php :: php search in object. array 
Php :: set php path in ubuntu 
Php :: Allowed memory size of 1610612736 bytes exhausted 
Php :: woocommerce add custom field data to cart page 
Php :: php get index of current item array_reduce 
Php :: laravel display old value in form 
Php :: remove all post in wordpress by query 
Php :: upload file laravel 
Php :: php get all url parameters 
Php :: get field acf 
Php :: php array common element 
Php :: php function exists 
Php :: array_search in php 
Php :: php usort keep keys 
Php :: php curl 
Php :: laravel eloquent get last 
Php :: php mysql if exists 
Php :: php number positive 
Php :: laravel update and insert transaction 
Php :: show display error php 
Php :: Skip WooCommerce Cart page and redirect to Checkout page 
Php :: lumen generate app key 
Php :: acf gallery 
Php :: laravel string capitalize in view 
Php :: fetch body show in php code 
Php :: wordpress show notice 
Php :: php slugify 
Php :: laravel run seeder 
Php :: php start server command 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =