1.2.748. Named Parameter Usage¶
Named parameters is a way to call a method, by specifying the name of the argument, instead of their position order.
Named parameters works for both custom methods and PHP native functions.
<?php
// named parameters
foo(a : 1, b : 2);
foo(b : 2, a : 1);
// positional parameters
foo(1, 2);
function foo($a, $b) { }
?>
1.2.748.1. Specs¶
Short name |
Php/NamedParameterUsage |
Rulesets |
All, Appinfo, CompatibilityPHP53, CompatibilityPHP54, CompatibilityPHP55, CompatibilityPHP56, CompatibilityPHP70, CompatibilityPHP71, CompatibilityPHP72, CompatibilityPHP73, CompatibilityPHP74 |
Exakat since |
2.3.0 |
PHP Version |
With PHP 8.0 and more recent |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Features |
named-parameter |
Available in |