检查行是否重复并打印这些行PHP

时间:2020-02-03 12:30:51

标签: php

DB中的数据安排如下: ID-名称-RAM-处理器-存储-网址

在我根据规格进行过滤的查询之后,得到了以下数组:

Array ( [id] => 1 [name] => HP [ram] => 8GB [graphcard] => 2GB [processor] => i5 [url] => store1)
Array ( [id] => 2 [name] => HP [ram] => 8GB [graphcard] => 2GB [processor] => i5 [url] => store2)
Array ( [id] => 3 [name] => HP [ram] => 8GB [graphcard] => 2GB [processor] => i5 [url] => store3)
Array ( [id] => 4 [name] => Lenovo [ram] => 8GB [graphcard] => 2GB [processor] => i5 [url] => store2)
Array ( [id] => 5 [name] => Apple [ram] => 8GB [graphcard] => 2GB [processor] => i5 [url] => store1)

我想获取其中[name]与其他数组重复的行
在此示例中,我将获得前三个数组。

到目前为止,我一直在尝试使用array_intersect_assocarray_diff_assoc 但这仅返回发生的第一个差异。

有人熟悉获取重复项的方法吗?

0 个答案:

没有答案