1.2.806. No List With String¶
<?php
$x = 'abc';
list($a, $b, $c) = $x;
//list($a, $b, $c) = 'abc'; Never works
print $c;
// PHP 5.6- displays 'c'
// PHP 7.0+ displays nothing
?>
See also PHP 7.0 Backward incompatible changes.
1.2.806.1. Suggestions¶
Use str_split() to break a string into bytes
Use substr() or $string[$offset] syntax to access specific bytes in the string
1.2.806.2. Specs¶
Short name |
Php/NoListWithString |
Rulesets |
All, Changed Behavior, CompatibilityPHP53, CompatibilityPHP54, CompatibilityPHP55, CompatibilityPHP56 |
Exakat since |
0.8.4 |
PHP Version |
With PHP 7.0 and older |
Severity |
Major |
Time To Fix |
Instant (5 mins) |
Precision |
High |
Features |
list |
Available in |