Php 重温-从阵列中删除重复std对象的最快方法

Php 重温-从阵列中删除重复std对象的最快方法,php,arrays,performance,Php,Arrays,Performance,我已经阅读了很多关于从数组中删除重复对象的主题,更重要的是,删除std类对象。我的问题是,对于哪种方法更好地用于性能方面,似乎没有达成一致意见。大多数问题都是重复的,主要是这个问题 看起来有两种流行的方法是array\u unique()和foreach循环,还有另外两种或三种不太被提及的方法 不幸的是,我的开发站点是为WordPress建立的,安装了相当小的测试,所以当涉及到更大的数据集时,我无法真正运行性能测试 让我们举个例子:(注意:这只是一个小数组,可以包含数百个std对象) 基于

我已经阅读了很多关于从数组中删除重复对象的主题,更重要的是,删除std类对象。我的问题是,对于哪种方法更好地用于性能方面,似乎没有达成一致意见。大多数问题都是重复的,主要是这个问题

看起来有两种流行的方法是
array\u unique()
foreach
循环,还有另外两种或三种不太被提及的方法

不幸的是,我的开发站点是为WordPress建立的,安装了相当小的测试,所以当涉及到更大的数据集时,我无法真正运行性能测试

让我们举个例子:(注意:这只是一个小数组,可以包含数百个std对象)


基于上面的链接问题,而且一般来说,基于性能和资源管理,删除重复项的最佳选择是什么?

array\u unique
在这种情况下不会直接起作用。@Sougata感谢您的回答。请您解释一下,
array\u unique
可以应用于1D数组。@Sougata与我在这里的答案中读到的不同
 Array
(
[0] => stdClass Object
    (
        [term_id] => 1
        [name] => First term
        [slug] => first-term
        [term_group] => 0
        [term_taxonomy_id] => 1
        [taxonomy] => category
        [description] => This is the first term
        [parent] => 0
        [count] => 2
    )

[1] => stdClass Object
    (
        [term_id] => 2
        [name] => Second Term
        [slug] => second-term
        [term_group] => 0
        [term_taxonomy_id] => 2
        [taxonomy] => category
        [description] => 
        [parent] => 0
        [count] => 2
    )

[2] => stdClass Object
    (
        [term_id] => 1
        [name] => First term
        [slug] => first-term
        [term_group] => 0
        [term_taxonomy_id] => 1
        [taxonomy] => category
        [description] => This is the first term
        [parent] => 0
        [count] => 2
    )

[3] => stdClass Object
    (
        [term_id] => 2
        [name] => Second Term
        [slug] => second-term
        [term_group] => 0
        [term_taxonomy_id] => 2
        [taxonomy] => category
        [description] => 
        [parent] => 0
        [count] => 2
    )

)