如何检查一个给定数组中任何对象的键值是否与另一个数组中任何对象的键值匹配?
有两个数组,$personorg_terms和$org_terms_in_latest_post。
name我想检查一个中的值是否存在于name另一个中。如果是这样,我们应该返回那个name。
在下面的示例中,“S4 Capital”是一个匹配项,应该返回。
$personorg_terms包含:
Array
(
[0] => WP_Term Object
(
[term_id] => 7436
[name] => WPP
[slug] => wpp
[term_group] => 0
[term_taxonomy_id] => 7436
[taxonomy] => company
[description] => WPP plc is a British multinational advertising and public relations company with its main management office in London, England, and its executive office in Dublin, Ireland.
[parent] => 0
[count] => 81
[filter] => raw
[term_order] => 0
)
[1] => WP_Term Object
(
[term_id] => 11814
[name] => S4 Capital
[slug] => s4-capital
[term_group] => 0
[term_taxonomy_id] => 11814
[taxonomy] => company
[description] => S4Capital is building a purely digital advertising and marketing services business for global, multi- national, regional, local and millennial-driven influencer brands.
[parent] => 0
[count] => 6
[filter] => raw
[term_order] => 0
)
)
$org_terms_in_latest_post包含:
Array
(
[0] => WP_Term Object
(
[term_id] => 11814
[name] => S4 Capital
[slug] => s4-capital
[term_group] => 0
[term_taxonomy_id] => 11814
[taxonomy] => company
[description] => S4Capital is building a purely digital advertising and marketing services business for global, multi- national, regional, local and millennial-driven influencer brands.
[parent] => 0
[count] => 6
[filter] => raw
[term_order] => 0
)
)
叮当猫咪