What is the purpose of the "break 2;" command in PHP loops?

The "break 2;" command in PHP loops is used to exit two levels of nested loops at once. This can be useful when you need to break out of multiple nested loops simultaneously without having to set flags or use other workarounds. It helps streamline the code and make it more readable by avoiding unnecessary complexity.

for ($i = 0; $i < 5; $i++) {
    for ($j = 0; $j < 5; $j++) {
        if ($i == 2 && $j == 2) {
            break 2;
        }
        echo "i: $i, j: $j\n";
    }
}