I have an array $products and I this is how i add elements to it.
$products[] = ['name'=>'prod1', 'qty'=>'5', 'price'=>'20'];
$products[] = ['name'=>'prod2', 'qty'=>'10', 'price'=>'30'];
$products[] = ['name'=>'prod3', 'qty'=>'15', 'price'=>'40'];
My question is, is there a way to add all three sets of elements in a single syntax. for example:
$products[] = ['name'=>'prod1', 'qty'=>'5', 'price'=>'20'],
['name'=>'prod2', 'qty'=>'10', 'price'=>'30'],
['name'=>'prod3', 'qty'=>'15', 'price'=>'40'];
array_merge, but to use it, you need to create an array with the new items you want to add. I'm not sure it is interesting.