我有一个这样的数组
Array
(
[0] => Array
(
[id] => 1
[store_id] => 2
[store_str] => Andrew Brennan
[supplier_id] => 51
[supplier_str] => Dyson
[brand_id] => 4
[brand_str] => Dyson
[category_id] => 2
[category_str] => SDA
[category_short_name] => SDA
[added_by] => 1
[inserted_on] => 1351664553
[status] => 1
[status_str] => Active
)
[1] => Array
(
[id] => 3
[store_id] => 4
[store_str] => Berney Crossan & Sons Ltd
[supplier_id] => 51
[supplier_str] => Dyson
[brand_id] => 4
[brand_str] => Dyson
[category_id] => 2
[category_str] => SDA
[category_short_name] => SDA
[added_by] => 1
[inserted_on] => 1351664553
[status] => 1
[status_str] => Active
) )
但我想将它们显示为像 $store_arr,$sup_arr,$cat_arr,$brand_arr.Means 这样的单个数组。如果我打印 $store_arr 它应该像
Array(
[2] => Andrew Brennan
[4] => Berney Crossan & Sons Ltd
)
像这样所有其他数组都应该是这样。我试过了
foreach($result as $k => $v) {
foreach($v as $key=>$value) {
$store_arr[$key['store_id']] = $key['store_str'];
}
}
但它给了我无关的数据数组。任何人都可以建议我如何得到它。提前谢谢