所以有这两个数组:
$one = array("engineering", "applied", "mathematics");
$se = "Applied mathematics is a branch of mathematics that concerns itself with mathematical methods that are typically used in science, engineering, business, and industry.";
$two = explode(' ', $se);
if (//those 3 values from $one exist in $two) {
echo "i got it!";
} else {
echo "you dint get :(";
}
我正在研究这个,但我没有找到任何简单的答案。你能帮助我吗?
答案 0 :(得分:1)
if ( array_intersect( $one, $two ) ) {
// arrays share one or more terms
}
您应该strtolower($se)
,因为相交测试是===
。
答案 1 :(得分:1)
你可以使用array_intersect来检查一个中的值是否存在于两个中,如果你得到相同的数组,结果你知道它们都在两者中。