How can a while loop be terminated if a condition is met within the loop in PHP?

To terminate a while loop in PHP if a condition is met within the loop, you can use the `break` statement. This statement allows you to exit the loop prematurely if a specific condition is satisfied. By including an `if` statement within the loop that checks for the condition and then using `break` to exit the loop, you can effectively terminate the loop when needed.

$counter = 0;

while ($counter < 10) {
    echo $counter . "<br>";
    
    if ($counter == 5) {
        break; // exit the loop if counter is equal to 5
    }
    
    $counter++;
}