Php 压缩两个数组不是有一个简单的if条件吗

Php 压缩两个数组不是有一个简单的if条件吗,php,arrays,if-statement,Php,Arrays,If Statement,因此有两个阵列: $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 = exp

因此有两个阵列:

$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 :(";
}
我正在对此进行研究,但没有找到任何简单的答案。你能帮我吗

试试看:

您可能应该
strtolower($se)
,因为intersect测试是
==
您可以使用它来检查一个值是否存在于两个值中,如果您得到相同的数组,那么您知道它们都存在于两个值中

if ( array_intersect( $one, $two ) ) {
    // arrays share one or more terms
}