1.2.214. Conditional Structures

Structures that are defined, but only executed conditionally.

It is possible to create conditioned functions, classes, interfaces, traits and enumerations. Constants have to be defined with define() and can’t use the const keyword.

Classes elements, such as methods, can’t be conditional.

<?php

if (!function_exists('array_column')) {
    function array_column($a) {
        // some PHP
    }
}

if (!class_exists('foo')) {
    class foo {

    }
}

?>

1.2.214.1. Connex PHP features

1.2.214.1.1. Suggestions

  • Use different names, and apply autoloader.

1.2.214.1.2. Specs

Short name

Structures/ConditionalStructures

Rulesets

All, Changed Behavior

Exakat since

0.8.4

PHP Version

All

Severity

Time To Fix

Precision

Very high

Available in

Entreprise Edition, Exakat Cloud