What role does the loop play in the code snippet provided?

The loop in the code snippet provided is used to iterate over an array and print out each element. However, the loop is missing curly braces, causing only the first line of the loop to be executed within the loop. To fix this issue, we need to add curly braces around the lines of code we want to execute within the loop.

// Fixing the loop by adding curly braces
foreach($array as $element){
    echo $element . "<br>";
}