我怎样才能把这种阵列相结合:如何三个阵列与[0]作为钥匙插入一个
Array ([0] => 80) Array ([0] => 20) Array ([0] => 90)
到这样的阵列:
Array (
[0] => 80,
[1] => 20,
[2] => 90
);
代码:
$percentage_result = $percentage_query->result_array(); //output below:
输出:
Array
(
[0] => Array
(
[id] => 62
[list_id] => 55
[start_date] => 1459987200
[end_date] => 1459987200
[percentage] => 80
)
[1] => Array
(
[id] => 64
[list_id] => 55
[start_date] => 1459814400
[end_date] => 1459814400
[percentage] => 20
)
[2] => Array
(
[id] => 63
[list_id] => 55
[start_date] => 1459900800
[end_date] => 1459900800
[percentage] => 90
)
我想保存所有[百分比]并获得最高的一个。
这样做:
$null = array();
foreach ($percentage_result as $ptime) {
//Days between start date and end date -> seasonal price
$start_time = $ptime['start_date'];
$end_time = $ptime['end_date'];
$percentage_sm = explode(',', $ptime['percentage']);
$mrg = array_merge($null, $percentage_sm);
print_r($mrg);
$味精显示我:
Array
(
[0] => 80
)
Array
(
[0] => 20
)
Array
(
[0] => 90
)
我们e array_merge –
[array_merge()](http://www.php.net/manual/en/function.array-merge.php)也许....尝试看看PHP文档....他们可以是非常有帮助 –
@SunilPachlangia它不起作用。 –