
如何利用php语法获取两个数组的交集元素,生成一个新的数组?下面web建站小编给大家简单介绍一下具体实现代码!
$animalA = array("cat", "dog", "pig", "panda");
$animalB = array("dog", "panda", "fish", "snake");
$commonAnimal = array_intersect($animalA, $animalB);
print_r($commonAnimal);
//输出结果:
Array (
[1] => dog
[3] => panda
)
标签: array_intersect, php数组
上面是“php语法如何查询两个数组的交集元素”的全面内容,想了解更多关于 php入门 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_4351.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

js后退history.back()和history.go(-1)有什么不同
Fireflies APP最新版