将带有键的数组转换为其他格式的最简单方法是什么

I have the following array:

Array
(
    [key1] => 10
    [key2] => 7
    [key3] => 8
)

I want to convert it to the following structure:

Array
(
    [0] => Array
        (
            [section] => key1
            [quantity] => 10
        ),
    [1] => Array
        (
            [section] => key2
            [quantity] => 7
        ),
    [2] => Array
        (
            [section] => key3
            [quantity] => 8
        )
)

I tried to use array_map function, but inside the closure I get only a value without a key. Please, suggest me the easiest way to do it, without foreach.

Update
I think using foreach requires creation of an additional variable which makes the code messy and resource requiring.

Try using array_walk as

$result = array();
array_walk($arr, function ($v,$k) use(&$result) {
     $result[] = array('section' => $k, 'quantity' => $v);
});

demo using array_walk

Using foreach

$result = array();
foreach($arr as $key => $value){
    $result[] = array('section' => $key, 'quantity' => $value);
}

print_r($result);

demo using foreach

There's no reason not to use foreach for this. The best solution would be:

$cookedArray = [];
foreach ($rawArray as $key => $value)
{
    $cookedArray [] = ["section" => $key, "quantity" => $value];
}
$previous_array=array(
    'key1' => 10,
    'key2' => 7,
    'key3' => 8,
);

$new_array=array();
foreach($previous_array as $key => $value):
    $new_array[]=array('section'=>$key,'quantity'=>$value);

endforeach;
Print_r($new_array);

Output:

Array
(
    [0] => Array
        (
            [section] => key1
            [quantity] => 10
        )

    [1] => Array
        (
            [section] => key2
            [quantity] => 7
        )

    [2] => Array
        (
            [section] => key3
            [quantity] => 8
        )

)

About by updated requirement, I myself have came to this solution:

$section = array_map(function ($key,$value) {
    return ['section' => $key, 'quantity' => $value];
}, array_keys($section), array_values($section));

The only concern is about keys and values. Now I am testing, won't it mess up with each other, I mean keys mix with values?

Update
It worked fine. Thanks to the pointing of @Halcyon in comments. And all others who suggested solutions.