【发布时间】:2015-09-06 20:56:44
【问题描述】:
我有一个对象数组
[1] => Array
(
[0] => stdClass Object
(
[term_id] => 21
[name] => House
[slug] => house
[term_group] => 0
[term_taxonomy_id] => 21
[taxonomy] => product_cat
[description] =>
[parent] => 16
[count] => 2
[filter] => raw
)
[1] => stdClass Object
(
[term_id] => 12
[name] => stone
[slug] => stone
[term_group] => 0
[term_taxonomy_id] => 12
[taxonomy] => product_cat
[description] =>
[parent] => 8
[count] => 1
[filter] => raw
)
)
我需要检查[parent] 的值。
但作为父母指的是http://php.net/manual/en/keyword.parent.php
使用类似的东西:
foreach ($array_entry as $object) {
if ($object->parent === $something) {
....
} else {
....
}
}
不起作用。
如何访问父值?
我试过'parent' 还是不行。
【问题讨论】:
标签: php arrays wordpress object woocommerce