PHP数组对比函数,存在交集则返回真,否则返回假,需要的朋友可以参考下。
复制代码 代码如下:
$array1 = array('a', 'b', 'c', 'd');
$array2 = array('a', 'c');
$array3 = array_intersect($array1, $array2);
if($array3) {
echo '有交集';
}
?>
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn