How can foreach loops be effectively used in PHP to iterate through arrays?

Foreach loops in PHP are a convenient way to iterate through arrays, allowing you to access each element without needing to keep track of indexes. To use foreach loops effectively, you can simply define the array you want to iterate through and then use the foreach loop to loop through each element.

$fruits = array("apple", "banana", "orange");

foreach ($fruits as $fruit) {
    echo $fruit . "<br>";
}