Home >Backend Development >PHP Tutorial >PHP determines whether a sentence contains a certain keyword

PHP determines whether a sentence contains a certain keyword

巴扎黑
巴扎黑Original
2016-11-07 17:29:342715browse

<?php
 
$a="123456789.exe";
 
if(strstr($a,"exe"))
{
    echo "exe\n";
}
elseif(strstr($a,"123"))
{
    echo "一二三\n";
}
else
{
    echo "全无";
}
 
?>


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