1
2// using strip_tags and str_replace for REMOVE all html TAGS in php
3$text = '<p>Hello world.</p><!-- Comment --> <a href="https://learn-tech-tips.blogspot.com">Zidane</a>';
4echo strip_tags($text);
5
6//Hello world. Zidane
7
8$short_description = strip_tags(str_replace(" ", " ", $short_description));
9echo $short_description
10
11
12// Allow <p> and <a>
13echo strip_tags($text, '<p><a>');
14
15// <p>Hello world.</p><a href="https://learn-tech-tips.blogspot.com">Zidane</a>
1$text = '<a href="https://workforcenow.adp.com/mascsr/default/mdf/recruitment/recruitment.html?cid=ed2438b9-d7f4-45be-b3d8-8c924068c18a&ccId=2036080543_6069&jobId=329838&source=CC2&lang=en_US">https://workforcenow.adp.com/mascsr/default/mdf/recruitment/recruitment.html?cid=ed2438b9-d7f4-45be-b3d8-8c924068c18a&ccId=2036080543_6069&jobId=329838&source=CC2&lang=en_US</a>';
2
1$text = '<p>Test paraagraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';