0
我有一個數組$ result,當我對它執行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] => [email protected]
)
[3] => Array (
[parent_geo_zone_id] => 6
[name] => florida
[shipping_pool_geo_zone_id] => 6
[email] => [email protected]
)
[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'])
);
我正在使用打開的購物車。
'如果($結果[ 'parent_geo_zone_id'] === $結果[ 'shipping_pool_geo_zone_id'])' – splash58
@ splash58它說注意:未定義指數:shipping_pool_geo_zone_id –
'如果($ result ['parent_geo_zone_id'] === $ result ['shipping_pool_geo_zone_id']);'我忘了空間時,需要您的代碼:)現在測試 – splash58