<?php $rawitems = [['nope1' => 'a', 'nope2' => 'b'], ['nope1' => 'c', 'nope2' => 'd']]; $itemskey = ['key1', 'key2']; foreach ($rawitems as $row) { $tmp['key2'] = [$tmp['key2']]; $items[] = $tmp; }
Standard input is empty
Array
(
[0] => Array
(
[key1] => a
[key2] => Array
(
[0] => b
)
)
[1] => Array
(
[key1] => c
[key2] => Array
(
[0] => d
)
)
)