Home  >  Article  >  Backend Development  >  PHP determines whether a string contains html tag_PHP tutorial

PHP determines whether a string contains html tag_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:25:041007browse

function judgeHtml($str){
if($str != strip_tags($str)){
echo 'yes';
}else{
echo 'no';
}
}
judgeHtml('

a');
echo '
';
judgeHtml('a');
Output: Yes
No

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825233.htmlTechArticlefunction judgeHtml($str){ if($str != strip_tags($str)){ echo 'Yes' ; }else{ echo 'none'; } } judgeHtml('pa'); echo 'br /'; judgeHtml('a'); Output: yes or no...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn