What is the purpose of the "break" statement in PHP?

The "break" statement in PHP is used to exit a loop prematurely. It is commonly used in switch statements to exit the switch block. By using the "break" statement, you can stop the execution of the loop or switch statement and continue with the rest of the code. Example:

$colors = array("red", "green", "blue");

foreach ($colors as $color) {
    if ($color == "green") {
        break; // exit the loop if the color is green
    }
    echo $color . "<br>";
}