$item = new Item('Apple', 1.99); $name = $item->getName(); echo $name; // Output: Apple
$itemArray = [ new Item('Banana', 0.99), new Item('Orange', 2.99), new Item('Grapes', 3.49) ]; foreach ($itemArray as $item) { $name = $item->getName(); echo $name . 'In this example, we create an array of Item objects with different names and prices. We then loop through each Item in the array and call the getName method on each object. The result is displayed on the webpage using the echo function. The package library that contains the Item class is not specified in this example. It is possible that the Item class is part of a custom library or a third-party library.
'; }