【发布时间】:2014-08-10 14:02:57
【问题描述】:
我知道如何判断你的字符串是否等于数组值:
$colors = array("blue","red","white");
$string = "white";
if (!in_array($string, $colors)) {
echo 'not found';
}
...但是如何找到字符串是否包含数组值的任何部分?
$colors = array("blue","red","white");
$string = "whitewash"; // I want this to be found in the array
if (!in_array($string, $colors)) {
echo 'not found';
}
【问题讨论】:
标签: php