Home >Backend Development >PHP Tutorial >PHP数组对比函数,存在交集则返回真,否则返回假_php技巧

PHP数组对比函数,存在交集则返回真,否则返回假_php技巧

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-17 09:21:231126browse
复制代码 代码如下:

$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