如何检查字符串是否包含特定的单词?考虑:$a = 'How are you?';if ($a contains 'are')
echo 'true';假设我有上面的代码,写语句的正确方法是什么?if ($a contains 'are')?
3 回答
![?](http://img1.sycdn.imooc.com/545863c10001865402200220-100-100.jpg)
富国沪深
TA贡献1790条经验 获得超9个赞
// returns true if $needle is a substring of $haystackfunction contains($needle, $haystack){ return strpos($haystack, $needle) !== false;}
- 3 回答
- 0 关注
- 1050 浏览
添加回答
举报
0/150
提交
取消