Hi I am a C# developer and currently working a bit in PHP. I know this is a very simple task but I really don't have an idea for this. I have to create a list with the items to be dynamically created with foreach loop. These are the static list items that I want to create list dynamically with foreach loop.
$item_1 = new Item();
$item_1->setName('Item 1')
->setCurrency('USD')
->setQuantity(2)
->setPrice('15');
$item_2 = new Item();
$item_2->setName('Item 2')
->setCurrency('USD')
->setQuantity(4)
->setPrice('7');
$item_3 = new Item();
$item_3->setName('Item 3')
->setCurrency('USD')
->setQuantity(1)
->setPrice('20');
// add item to list
$item_list = new ItemList();
$item_list->setItems(array($item_1, $item_2, $item_3));