> For the complete documentation index, see [llms.txt](https://php7.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://php7.shujuwajue.com/php-71x-xin-te-xing/xin-te-xing/listxian-zai-zhi-chi-jian-ming.md).

# list()现在支持键名

现在[list()](https://php.net/manual/zh/function.list.php)支持在它内部去指定键名。这意味着它可以将任意类型的数组 都赋值给一些变量（与短数组语法类似）

**此例子我在PHP Version 7.1.5测试中始终报错，具体的功能和对称阵列解构的新特征一样**

```php
<?php
$data = [
    ['id' => 1, 'name' => 'Tom'],
    ['id' => 2, 'name' => 'Fred'],
];

while (list('id' => $id, 'name' => $name) = $data) {
    // logic here with $id and $name
}
```
