如何以我所需的方式从前一个数组创建一个新数组?

I Have an array like these . After json encoding i found these like the first result. but i want my array like second array

Array
(
    [2017-09-10] => 178934.35
    [2017-09-09] => 700000
    [2017-09-07] => 194432.25
    [2017-09-06] => 183252.9
    [2017-09-03] => 1311.45
    [2017-09-02] => 1186.55
    [2017-08-30] => 204660.3
    [2017-08-29] => 290486.45
    [2017-08-28] => 2400
    [2017-08-27] => 600.00
    [2017-08-26] => 840.00
    [2017-08-16] => 600.00
)

first result after json encoding.

{"2017-09-10":178934.35,"2017-09-09":700000,"2017-09-07":194432.25,"2017-09-06":183252.9,"2017-09-03":"1311.45","2017-09-02":"1186.55","2017-08-30":204660.3,"2017-08-29":290486.45,"2017-08-28":2400,"2017-08-27":"600.00","2017-08-26":"840.00","2017-08-16":"600.00"}

Required array format

Array
(
    [0] => Array
        (
            [cols] => 2017-09-10
            [rows] => 177622.91
        )

)

after json Enconding

[{"cols":"2017-09-10","rows":177622.91} {"cols":"2017-09-10","rows":177622.91}]

Iterate over your array and build a new one:

$source_array = [];
$new_array = [];
foreach ($source_array as $key => $value) {
    $new_array[] = [
        'cols' => $key,
        'rows' => $value,
    ];
}