如何更改数组索引和使用值序列?

时间:2017-07-19 08:24:14

标签: php arrays

我以下面提到的格式获得了名为“Result”的数组。但我希望下面提到的数组名为“Desire_result”。请帮助我下一步做什么,以便我能实现它。

结果:

<?php 
Array
(
    [0] => Array
        (
            [0] => 2017-01-01
            [1] => 2017-01-15
            [2] => 2017-01-20
            [3] => 2017-01-30
        )

    [1] => Array
        (
            [0] => 2017-02-01
            [1] => 2017-02-12
            [2] => 2017-02-17
            [3] => 2017-02-25
        )

    [2] => Array
        (
            [0] => 2017-03-01
            [1] => 2017-04-01
            [2] => 2017-04-15
            [3] => 2017-04-25
        )

    [3] => Array
        (
            [0] => 2017-05-01
            [1] => 2017-05-13
            [2] => 2017-05-20
            [3] => 2017-05-26
        )

    [4] => Array
        (
            [0] => 2017-06-01
            [1] => 2017-06-25
            [2] => 2017-07-15
        )

)
?>

Desire_result:

<?php
Array
(

    [0] => 2017-01-01
    [1] => 2017-01-15
    [2] => 2017-01-20
    [3] => 2017-01-30        
    [4] => 2017-02-01
    [5] => 2017-02-12
    [6] => 2017-02-17
    [7] => 2017-02-25
    [8] => 2017-03-01
    [9] => 2017-04-01
    [10] => 2017-04-15
    [11] => 2017-04-25
    [12] => 2017-05-01
    [13] => 2017-05-13
    [14] => 2017-05-20
    [15] => 2017-05-26
    [16] => 2017-06-01
    [17] => 2017-06-25
    [18] => 2017-07-15
) 
?> 

1 个答案:

答案 0 :(得分:0)

$desiredResult = array_merge(...$myResult);