How to remove specific html tags from a string in PHP

1 Answer

0 votes
$s = 'PHP is a <i>general-purpose</i> scripting language ' . "\n" . 
     'geared towards web <br>development. It was originally ' . "\n" .
     'created by <br>Danish-Canadian <b>programmer Rasmus Lerdorf</b> in 1994';

$s = str_replace(array("<I>", "</i>", "<br>"), "", $s);	

echo $s;




/*
run:

PHP is a general-purpose scripting language 
geared towards web development. It was originally 
created by Danish-Canadian <b>programmer Rasmus Lerdorf</b> in 1994

*/

 



answered Jan 29, 2022 by avibootz
...