如何比较打开购物车中数组中特定索引的值
How to compare values of specific index in an array in open cart
我有一个数组 $ results,当我对它执行 print_r 时,它会给出以下输出。
Array (
[0] => Array (
[parent_geo_zone_id] => 3
[name] => UK VAT Zone
[shipping_pool_geo_zone_id] =>
[email] =>
)
[1] => Array (
[parent_geo_zone_id] => 4
[name] => UK Shipping
[shipping_pool_geo_zone_id] =>
[email] =>
)
[2] => Array (
[parent_geo_zone_id] => 5
[name] => Texas
[shipping_pool_geo_zone_id] => 5
[email] => ammar.instantsoft@gmail.com
)
[3] => Array (
[parent_geo_zone_id] => 6
[name] => florida
[shipping_pool_geo_zone_id] => 6
[email] => ammar_ul_hasan@hotmail.com
)
[4] => Array (
[parent_geo_zone_id] => 7
[name] => alaska
[shipping_pool_geo_zone_id] =>
[email] =>
)
)
我要比较以下指标
'parent_geo_zone_id' and 'shipping_pool_geo_zone_id '
像这样
if($results->array['parent_geo_zone_id']==$results->array['shipping_pool_geo_zone_id '])
如果这两个 ID 相等,我想发送选中的复选框值以查看其他未选中的情况。
foreach ($results as $result) {
$this->data['geo_zones'][] = array(
'geo_zone_id' => $result['parent_geo_zone_id'],
'name' => $result['name'],
'email' => $result['email'],
'selected' => isset($this->request->post['selected']) && in_array($result['geo_zone_id'], $this->request->post['selected'])
);
我正在使用开放式购物车。
你就可以用这样的表达方式
if($result['parent_geo_zone_id'] === $result['shipping_pool_geo_zone_id'])
{
// any stuff for true
}
else
{
// any stuff for false
}
我有一个数组 $ results,当我对它执行 print_r 时,它会给出以下输出。
Array (
[0] => Array (
[parent_geo_zone_id] => 3
[name] => UK VAT Zone
[shipping_pool_geo_zone_id] =>
[email] =>
)
[1] => Array (
[parent_geo_zone_id] => 4
[name] => UK Shipping
[shipping_pool_geo_zone_id] =>
[email] =>
)
[2] => Array (
[parent_geo_zone_id] => 5
[name] => Texas
[shipping_pool_geo_zone_id] => 5
[email] => ammar.instantsoft@gmail.com
)
[3] => Array (
[parent_geo_zone_id] => 6
[name] => florida
[shipping_pool_geo_zone_id] => 6
[email] => ammar_ul_hasan@hotmail.com
)
[4] => Array (
[parent_geo_zone_id] => 7
[name] => alaska
[shipping_pool_geo_zone_id] =>
[email] =>
)
)
我要比较以下指标
'parent_geo_zone_id' and 'shipping_pool_geo_zone_id '
像这样
if($results->array['parent_geo_zone_id']==$results->array['shipping_pool_geo_zone_id '])
如果这两个 ID 相等,我想发送选中的复选框值以查看其他未选中的情况。
foreach ($results as $result) {
$this->data['geo_zones'][] = array(
'geo_zone_id' => $result['parent_geo_zone_id'],
'name' => $result['name'],
'email' => $result['email'],
'selected' => isset($this->request->post['selected']) && in_array($result['geo_zone_id'], $this->request->post['selected'])
);
我正在使用开放式购物车。
你就可以用这样的表达方式
if($result['parent_geo_zone_id'] === $result['shipping_pool_geo_zone_id'])
{
// any stuff for true
}
else
{
// any stuff for false
}