我有 2 x 2D 数组,其中包含从数据库返回的值。
目前我正在做一个 foreach 循环并将返回的值放到每个数组的单独表中:
例如:
<table>
<tr>
<td>Auto Bavaria Midrand BMW</td>
<td>63</td>
<td>39</td>
</tr>
...
</table>
<table>
<tr>
<td>Auto Bavaria Midrand BMW</td>
<td>40</td>
<td>15</td>
...
</tr>
</table>
但我需要以这种格式返回值,仅在 1 个表中:
<table>
<tr>
<td>Auto Bavaria Midrand BMW</td>
//the name of the record does not need to be repeated, only the values
<td>63</td>
<td>39</td>
<td>40</td> //values from 2nd array
<td>15</td> // values from 2nd array
</tr>
...//next record set
</table>
Array
(
[0] => Array
(
[DealerName] => Auto Bavaria Midrand BMW
[dealersContacted] => 63
[DealerContact_Y] => 39
[DealerContact_N] => 15
[DealerShipId] => 21730
[DataId] => 23527
)
//extra returned records
)
Array
(
[0] => Array
(
[DealerName] => Auto Bavaria Midrand BMW
[dealersContacted] => 65
[DealerContact_Y] => 40
[DealerContact_N] => 15
[DealerShipId] => 21730
[DataId] => 23527
)
//extra returned records
)
我可以做它的 php 方面,我的问题是是否有一个数组函数可以只合并数组的所需位?我已经搜索过,只是变得越来越困惑。