1.2.19. Add Default Value

Parameter in methods definition may receive a default value. This allows the called method to set a value when the parameter is omitted.

<?php

function foo($i) {
    if (!is_integer($i)) {
        $i = 0;
    }
}

?>

See also Function arguments.

1.2.19.1. Connex PHP features

1.2.19.1.1. Suggestions

  • Add a default value for parameters

1.2.19.1.2. Specs

Short name

Functions/AddDefaultValue

Rulesets

All, Changed Behavior, Suggestions

Exakat since

1.4.5

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Examples

Zurmo, Typo3

Available in

Entreprise Edition, Exakat Cloud