1.2.637. List With Reference¶
Support for references in list calls is not backward compatible with older versions of PHP. The support was introduced in PHP 7.3.
<?php
$array = [1,2,3];
[$c, &$d, $e] = $a;
$d++;
$c++;
print_r($array);
/*
displays
Array
(
[0] => 1 // Not a reference to $c, unchanged
[1] => 3 // Reference from $d
[2] => 3
)
*/
?>
See also list() Reference Assignment.
1.2.637.1. Connex PHP features¶
1.2.637.1.1. Suggestions¶
Avoid using references in list for backward compatibility
1.2.637.1.2. Specs¶
Short name |
Php/ListWithReference |
Rulesets |
All, CompatibilityPHP53, CompatibilityPHP54, CompatibilityPHP55, CompatibilityPHP56, CompatibilityPHP70, CompatibilityPHP71, CompatibilityPHP72 |
Exakat since |
1.1.6 |
PHP Version |
With PHP 7.3 and more recent |
Severity |
Major |
Time To Fix |
Slow (1 hour) |
Precision |
Very high |
Available in |