In the provided code, how does the Break statement affect the loop execution and how can it be optimized for better performance?

The Break statement in the provided code prematurely ends the loop execution when a specific condition is met. While this may be necessary in some cases, it can affect the performance negatively as it breaks out of the loop before completing all iterations. To optimize the code for better performance, consider refactoring the loop logic to eliminate the need for the Break statement by using a different approach or restructuring the code flow.

// Optimized code without using Break statement
$numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
$found = false;

foreach ($numbers as $number) {
    if ($number == 5) {
        $found = true;
        break;
    }
}

if ($found) {
    echo "Number 5 is found in the array.";
} else {
    echo "Number 5 is not found in the array.";
}