name = "Foreach With list()";
description = "Foreach loops have the ability to use list as blind variables. This syntax assign directly array elements to various variables. 

PHP 5.5 introduced the usage of list in foreach() loops. Until PHP 7.1, it was not possible to use non-numerical arrays as list() wouldn't support string-indexed arrays.

<?php
    // PHP 5.5 and later, with numerically-indexed arrays
    foreach($array as list($a, $b)) { 
        // do something 
    }


    // PHP 7.1 and later, with arrays
    foreach($array as list('col1' => $a, 'col3' => $b)) { // 'col2 is ignored'
        // do something 
    }
?>

Previously, it was compulsory to extract() the data from the blind array : 

<?php
    foreach($array as $c) { 
        list($a, $b) = $c;
        // do something 
    }
?>

See also `The list function & practical uses of array destructuring in PHP <https://sebastiandedeyne.com/the-list-function-and-practical-uses-of-array-destructuring-in-php>`_.

";
clearphp = "";
phpversion = "5.5+";
severity = "S_MINOR";
timetofix = "T_SLOW";
exakatSince = "0.8.4";
