What are potential pitfalls when using break; in PHP scripts and how can they be avoided?

When using the `break;` statement in PHP scripts, potential pitfalls include accidentally breaking out of nested loops or switch statements when only intending to break out of the innermost loop or switch. To avoid this, use labels to specify which loop or switch statement to break out of.

$found = false;

foreach ($outerArray as $innerArray) {
    foreach ($innerArray as $value) {
        if ($value == $searchValue) {
            $found = true;
            break 2; // break out of both inner and outer loops
        }
    }
}

if ($found) {
    echo "Value found!";
} else {
    echo "Value not found.";
}