1.2.557. Implode() Arguments Order¶
implode() used to accept two signatures, but is only recommending one. Both types orders of string then array, and array then string have been possible until PHP 7.4.
In PHP 7.4, the order array then string is deprecated, and emits a warning. It will be removed in PHP 8.0.
<?php
$glue = ',';
$pieces = range(0, 4);
// documented argument order
$s = implode($glue, $pieces);
// Pre 7.4 argument order
$s = implode($pieces, $glue);
// both produces 0,1,2,3,4
?>
See also implode().
1.2.557.1. Suggestions¶
Always use the array as the second argument
1.2.557.2. Specs¶
Short name |
Structures/ImplodeArgsOrder |
Rulesets |
|
Exakat since |
1.9.2 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Changed Behavior |
PHP 7.4 |
Precision |
Very high |
Available in |