1.2.932. PHP Alternative Syntax

This rule identifies the usage of alternative syntax in the code, for if then, switch, while, for and foreach.

Alternative syntax is another way to write the same expression. Alternative syntax is less popular than the normal one, and associated with older coding practices.

<?php

// Normal syntax
if ($a == 1) {
    print $a;
}

// Alternative syntax : identical to the previous one.
if ($a == 1) :
    print $a;
endif;

?>

See also Alternative syntax.

1.2.932.1. Specs

Short name

Php/AlternativeSyntax

Rulesets

All, Appinfo, CE

Exakat since

0.8.4

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

alternative-syntax, foreach, while, do-while, for, switch

Available in

Entreprise Edition, Community Edition, Exakat Cloud