【发布时间】:2020-04-15 16:19:34
【问题描述】:
我有以下数组,我想简化数组以添加我的逻辑来检查产品数量
数组如下:-
$conditions = Array
(
[type] => Magento\SalesRule\Model\Rule\Condition\Combine
[attribute] =>
[operator] =>
[value] => 1
[is_value_processed] =>
[aggregator] => all
[conditions] => Array
(
[0] => Array
(
[type] => Magento\SalesRule\Model\Rule\Condition\Product\Found
[attribute] =>
[operator] =>
[value] => 1
[is_value_processed] =>
[aggregator] => all
[conditions] => Array
(
[0] => Array
(
[type] => Magento\SalesRule\Model\Rule\Condition\Product
[attribute] => category_ids
[operator] => ==
[value] => 5
[is_value_processed] =>
)
[1] => Array
(
[type] => Magento\SalesRule\Model\Rule\Condition\Product
[attribute] => category_factor
[operator] => ==
[value] => 13
[is_value_processed] =>
)
)
)
[1] => Array
(
[type] => Magently\CustomerRule\Model\Rule\Condition\Customer
[attribute] => product_qty
[operator] => >=
[value] => 99
[is_value_processed] =>
)
)
)
我想检查attribute operator 和value 如下:
if(product_qty >= 99){
//do your stuff
}
请帮我简化这个数组以添加我的条件来检查产品数量。
【问题讨论】:
-
您的数组是否很大并检查元素或只是想访问值?
-
是的,我的数组很大,我想按照说明检查条件
标签: php arrays multidimensional-array