相关疑难解决方法(0)

如何检查字符串是否包含特定单词?

考虑:

$a = 'How are you?';

if ($a contains 'are')
    echo 'true';
Run Code Online (Sandbox Code Playgroud)

假设我有上面的代码,编写语句的正确方法是什么if ($a contains 'are')

php string substring contains string-matching

2663
推荐指数
36
解决办法
471万
查看次数

如何使用PHP检查另一个字符串中是否包含单词?

伪代码

text = "I go to school";
word = "to"
if ( word.exist(text) ) {
    return true ;
else {
    return false ;
}
Run Code Online (Sandbox Code Playgroud)

我正在寻找一个PHP函数,如果文本中存在单词,则返回true.

php string

61
推荐指数
4
解决办法
6万
查看次数

标签 统计

php ×2

string ×2

contains ×1

string-matching ×1

substring ×1