考虑:
$a = 'How are you?';
if ($a contains 'are')
echo 'true';
Run Code Online (Sandbox Code Playgroud)
假设我有上面的代码,编写语句的正确方法是什么if ($a contains 'are')?
伪代码
text = "I go to school";
word = "to"
if ( word.exist(text) ) {
return true ;
else {
return false ;
}
Run Code Online (Sandbox Code Playgroud)
我正在寻找一个PHP函数,如果文本中存在单词,则返回true.