How can PHP loops be utilized effectively in generating and displaying content?

PHP loops can be utilized effectively in generating and displaying content by iterating over arrays or databases to dynamically generate content based on the data. This allows for the creation of dynamic and reusable code that can display a varying number of items without the need for hardcoding each individual item.

<?php
// Sample array of items
$items = array("Item 1", "Item 2", "Item 3");

// Loop through the array and display each item
foreach ($items as $item) {
    echo "<p>$item</p>";
}
?>