"detect html tags in a string" Answer’s

0

A simple solution is:

if($string != strip_tags($string)) {
    // contains HTML
}

The benefit of this over a regex is it's easier to understand, however I could not comment on the speed of execution of either solution.

Wednesday, March 31, 2021
 
DCD
answered 11 Months ago
DCD
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :