1.2.87. Break With 0

It is not possible to break 0 : it makes no sense. Break 1 is the minimum, and is the default value.

<?php
    // Can't break 0. Must be 1 or more, depending on the level of nesting.
    for($i = 0; $i < 10; $i++) {
        break 0;
    }

    for($i = 0; $i < 10; $i++) {
        for($j = 0; $j < 10; $j++) {
            break 2;
        }
    }

?>

1.2.87.1. Suggestions

  • Remove 0, or the break

1.2.87.2. Specs

Short name

Structures/Break0

Rulesets

All, CompatibilityPHP53

Exakat since

0.8.4

PHP Version

With PHP 5.4 and older

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Available in

Entreprise Edition, Exakat Cloud