出于某种原因,我正在为此苦苦挣扎。
我有 2 个数组。第一个是一个名为 colsArray 的标准数组,如下所示:
Array
(
[0] => fName
[1] => lName
[2] => city
)
第二个是一个名为 query_data 的多维数组,如下所示:
Array
(
[0] => Array
(
[recordID] => xxx
[fName] => xxx
[lName] => xxx
[address1] => xxx
[city] => xx
[zip] => xxx
[vin] => xxx
)
[1] => Array
(
[recordID] => xxx
[fName] => xxx
[lName] => xxx
[address1] => xxx
[city] => xxx
[zip] => xxx
[vin] => xxx
)
[2] => Array
(
[recordID] => xxx
[fName] => xxx
[lName] => xxx
[address1] => xxx
[city] => xxx
[zip] => xxx
[vin] => xxx
)
[3] => Array
(
[recordID] => xxx
[fName] => xxx
[lName] => xxx
[address1] => xxx
[city] => xxx
[zip] => xxx
[vin] => xxx
)
)
我只需要使用这两个数组来创建一个新数组,其中包含来自 query_data 数组的所有数据,其中键位于第一个数组 colsArray 中。新数组如下所示:
Array
(
[0] => Array
(
[fName] => xxx
[lName] => xxx
[city] => xx
)
[1] => Array
(
[fName] => xxx
[lName] => xxx
[city] => xx
)
[2] => Array
(
[fName] => xxx
[lName] => xxx
[city] => xx
)
[3] => Array
(
[fName] => xxx
[lName] => xxx
[city] => xx
)
)
对此的任何帮助都会很棒。
谢谢!