Code: Select all
'items' => array(
array(
'd' => 'description 1',
'u' => 12,
'q' => 1,
'type' => 1001001,
'vatRate' => 0.20,
),
array(
'd' => 'description 2',
'u' => 125,
'q' => 1,
'type' => 1001002,
'vatRate' => 0.20,
),
),
Code: Select all
$items = array();
$num = count($result);
$i = 0;
foreach ($result as $key => $v) {
$items .= array(
'd' => $v['d'],
's' => $v['s'],
'q' => 1,
'type' => $v['type'],
'vatRate' => 0.20,
);
if ($i != $num) {
$items .= ",";
}
$i++;
}
print_r($items);